Power menu: add sleep, hybrid sleep and hibernate buttons

This commit is contained in:
Alice Gaudon 2020-12-31 13:29:58 +01:00
parent cd1f142003
commit 0873d1719d
3 changed files with 10 additions and 3 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-save"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"></path><polyline points="17 21 17 13 7 13 7 21"></polyline><polyline points="7 3 7 8 15 8"></polyline></svg>

After

Width:  |  Height:  |  Size: 392 B

1
assets/icons/sleep.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-pause"><rect x="6" y="4" width="4" height="16"></rect><rect x="14" y="4" width="4" height="16"></rect></svg>

After

Width:  |  Height:  |  Size: 312 B

View File

@ -168,10 +168,12 @@ local launcher = awful.widget.button({
launcher:buttons(gears.table.join(launcher:buttons(),
awful.button({}, 1, nil, function() showAppLauncher(false) end)))
shutdown_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/power.svg", beautiful.power_menu_icon_color)
restart_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/refresh-cw.svg", beautiful.power_menu_icon_color)
logout_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/log-out.svg", beautiful.power_menu_icon_color)
lock_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/lock.svg", beautiful.power_menu_icon_color)
logout_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/log-out.svg", beautiful.power_menu_icon_color)
sleep_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/sleep.svg", beautiful.power_menu_icon_color)
hibernate_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/hibernate.svg", beautiful.power_menu_icon_color)
restart_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/refresh-cw.svg", beautiful.power_menu_icon_color)
shutdown_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/power.svg", beautiful.power_menu_icon_color)
os_menu = awful.widget.launcher({
image = beautiful.awesome_icon,
@ -183,6 +185,9 @@ os_menu = awful.widget.launcher({
{ "Open terminal", config.awesome.terminal },
{ "Lock", lockScreen, lock_icon },
{ "Logout", function() awesome.quit() end, logout_icon },
{ "Sleep", function() os.execute('systemctl suspend') end, sleep_icon},
{ "Hybrid sleep", function() os.execute('systemctl hybrid-sleep') end, hibernate_icon },
{ "Hibernate", function() os.execute('systemctl hibernate') end, hibernate_icon },
{ "Restart", function() os.execute('shutdown -r now') end, restart_icon },
{ "Shutdown", function() os.execute('shutdown now') end, shutdown_icon },
}