waybar-menu - Man Page

menu property

Overview

Some modules support a 'menu', which allows to have a popup menu whan a defined click is done over the module.

Properties

A module that implements a 'menu' needs 3 properties defined in its config :

menu:
typeof: string
Action that popups the menu. The possibles actions are :

OptionDescription
on-clickWhen you left-click on the module
on-click-releaseWhen you release left button on the module
on-double-clickWhen you double left click on the module
on-triple-clickWhen you triple left click on the module
on-click-middleWhen you middle click on the module using mousewheel
on-click-middle-releaseWhen you release mousewheel button on the module
on-double-click-middleWhen you double middle click on the module
on-triple-click-middleWhen you triple middle click on the module
on-click-rightWhen you right click on the module using
on-click-right-releaseWhen you release right button on the module
on-double-click-rightWhen you double right click on the module
on-triple-click-rightWhen you triple middle click on the module
on-click-backwardWhen you  click on the module using mouse backward button
on-click-backward-releaseWhen you release mouse backward button on the module
on-double-click-backwardWhen you double click on the module using mouse backward button
on-triple-click-backwardWhen you triple click on the module using mouse backawrd button
on-click-forwardWhen you  click on the module using mouse forward button
on-click-forward-releaseWhen you release mouse forward button on the module
on-double-click-forwardWhen you double click on the module using mouse forward button
on-triple-click-forwardWhen you triple click on the module using mouse forward button

menu-file:
typeof: string
Location of the menu descriptor file. There need to be an element of type

GtkMenu with id menu.

menu-actions:
typeof: array
The actions corresponding to the buttons of the menu. The identifiers of

each actions needs to exists as an id in the 'menu-file' for it to be linked properly.

Example

Module config :

  "custom/power": {
  	"format" : "⏻ ",
  		"tooltip": false,
  		"menu": "on-click",
  		"menu-file": "~/.config/waybar/power_menu.xml",
  		"menu-actions": {
  			"shutdown": "shutdown",
  			"reboot": "reboot",
  			"suspend": "systemctl suspend",
  			"hibernate": "systemctl hibernate",
  		},
  },

~/.config/waybar/power_menu.xml :

  <?xml version="1.0" encoding="UTF-8"?>
  <interface>
    <object class="GtkMenu" id="menu">
  	<child>
  		<object class="GtkMenuItem" id="suspend">
  			<property name="label">Suspend</property>
          </object>
  	</child>
  	<child>
          <object class="GtkMenuItem" id="hibernat">
  			<property name="label">Hibernate</property>
          </object>
  	</child>
      <child>
          <object class="GtkMenuItem" id="shutdown">
  			<property name="label">Shutdown</property>
          </object>
      </child>
      <child>
        <object class="GtkSeparatorMenuItem" id="delimiter1"/>
      </child>
      <child>
  		<object class="GtkMenuItem" id="reboot">
  			<property name="label">Reboot</property>
  		</object>
      </child>
    </object>
  </interface>

Styling Menus

Example

  menu {
  	border-radius: 15px;
  	background: #161320;
  	color: #B5E8E0;
  }
  menuitem {
  	border-radius: 15px;
  }

Info

2024-09-15