📝 improve waybar-menu file

This commit is contained in:
Benjamin Voisin 2024-05-28 21:02:07 +02:00
parent 8220dbb513
commit 885290d907
No known key found for this signature in database
GPG Key ID: C5C8EDD125FBFD78
1 changed files with 52 additions and 10 deletions

View File

@ -72,8 +72,18 @@ A module that implements a 'menu' needs 3 properties defined in its config :
each actions needs to exists as an id in the 'menu-file' for it to be linked each actions needs to exists as an id in the 'menu-file' for it to be linked
properly. properly.
# MENU-FILE
The menu-file is an `.xml` file representing a GtkBuilder. Documentation for it
can be found here : https://docs.gtk.org/gtk4/class.Builder.html
Here, it needs to have an element of type GtkMenu with id "menu". Eeach actions
in *menu-actions* are linked to elements in the *menu-file* file by the id of
the elements.
# EXAMPLE # EXAMPLE
Module config :
``` ```
"custom/power": { "custom/power": {
"format" : "⏻ ", "format" : "⏻ ",
@ -89,6 +99,38 @@ A module that implements a 'menu' needs 3 properties defined in its config :
}, },
``` ```
~/.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 # STYLING MENUS
- *menu* - *menu*