Add log out, suspend and hibernate options to module system

This commit is contained in:
adario7 2019-08-19 13:20:11 +02:00
parent 0c4326eb31
commit 4208db6475
2 changed files with 5 additions and 0 deletions

View file

@ -219,6 +219,7 @@ Modules and commandline utilities are only required for modules, the core itself
* sensors (for module 'sensors', as fallback)
* zpool (for module 'zpool')
* progress (for module 'progress')
* systemd (for module 'system')
# Examples
Here are some screenshots for all themes that currently exist:

View file

@ -70,6 +70,10 @@ class Module(bumblebee.engine.Module):
menu = bumblebee.popup_v2.PopupMenu()
menu.add_menuitem("shutdown", callback=functools.partial(self._on_command, "Shutdown", "Shutdown?", "shutdown -h now"))
menu.add_menuitem("reboot", callback=functools.partial(self._on_command, "Reboot", "Reboot?", "reboot"))
menu.add_menuitem("log out", callback=functools.partial(self._on_command, "Log out", "Log out?", "bash -c 'loginctl terminate-session $(cat /proc/self/sessionid)'"))
# don't ask for confirmation when suspending or hibernating
menu.add_menuitem("suspend", callback=functools.partial(bumblebee.util.execute, "systemctl suspend"))
menu.add_menuitem("hibernate", callback=functools.partial(bumblebee.util.execute, "systemctl hibernate"))
menu.show(widget)