Openbox Power menu setup
Adding Shutdown, Restart, Suspend, and Hibernate Options in Openbox Menu
If you’re using Openbox as your window manager and want quick access to power options like Shutdown, Restart, Suspend, and Hibernate, modifying the menu.xml
file is a simple and effective approach.
๐ Steps to Add Power Options
-
Locate your
menu.xml
file
Typically found at:~/.config/openbox/menu.xml
If it’s not there, check in
/etc/xdg/openbox/menu.xml
. -
Edit the File
Open it in your favorite text editor:vim ~/.config/openbox/menu.xml
Or use nano:
nano ~/.config/openbox/menu.xml
-
Add the Power Options
Inside the<menu>
section, add the following entries:<item label="Suspend"> <action name="Execute"><execute>systemctl suspend</execute></action> </item> <item label="Hibernate"> <action name="Execute"><execute>systemctl hibernate</execute></action> </item> <item label="Reboot"> <action name="Execute"><execute>systemctl reboot</execute></action> </item> <item label="Shutdown"> <action name="Execute"><execute>systemctl poweroff</execute></action> </item>
-
Apply Changes
After saving the file, refresh Openbox to apply the new menu options:openbox --reconfigure
๐ ๏ธ Troubleshooting
- If the commands donโt work, ensure you have the necessary permissions. You may need to allow non-root users to execute
systemctl
commands by modifying/etc/sudoers
:Add:sudo visudo
Then modifyyour_username ALL=(ALL) NOPASSWD: /bin/systemctl suspend, /bin/systemctl hibernate, /bin/systemctl reboot, /bin/systemctl poweroff
menu.xml
to use:<execute>sudo systemctl poweroff</execute>
๐ฏ Why This is Useful
- Eliminates the need for a terminal to execute power commands.
- Provides a graphical way to shut down, restart, or suspend your system.
- Enhances workflow efficiency when using Openbox as a lightweight window manager.
With this setup, you now have a streamlined way to manage power options directly from your Openbox menu. ๐