From b274ce9c2ba0b7eb3d8d0d3b25c8143ffc65678e Mon Sep 17 00:00:00 2001 From: Arkhist Date: Tue, 23 Jul 2019 17:30:45 +0200 Subject: [PATCH] Add shutdown menu --- icons/lock.svg | 1 + icons/log-out.svg | 1 + icons/power.svg | 1 + icons/refresh-cw.svg | 1 + rc.lua | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 37 insertions(+) create mode 100644 icons/lock.svg create mode 100644 icons/log-out.svg create mode 100644 icons/power.svg create mode 100644 icons/refresh-cw.svg diff --git a/icons/lock.svg b/icons/lock.svg new file mode 100644 index 0000000..de09d9d --- /dev/null +++ b/icons/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/log-out.svg b/icons/log-out.svg new file mode 100644 index 0000000..c9002c9 --- /dev/null +++ b/icons/log-out.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/power.svg b/icons/power.svg new file mode 100644 index 0000000..598308f --- /dev/null +++ b/icons/power.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/refresh-cw.svg b/icons/refresh-cw.svg new file mode 100644 index 0000000..06c358d --- /dev/null +++ b/icons/refresh-cw.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rc.lua b/rc.lua index b957126..6cea024 100644 --- a/rc.lua +++ b/rc.lua @@ -121,6 +121,38 @@ kbdlayout.switch = function() os.execute( config.kbSwitchCmd .. " " .. t ) end +shutdown_icon = awesome.load_image(awful.util.getdir("config") .. "/icons/power.svg") +restart_icon = awesome.load_image(awful.util.getdir("config") .. "/icons/refresh-cw.svg") +logout_icon = awesome.load_image(awful.util.getdir("config") .. "/icons/log-out.svg") +lock_icon = awesome.load_image(awful.util.getdir("config") .. "/icons/lock.svg") + +shutdownMenu_items = { + { "Shutdown", + function() + awful.spawn('sudo /sbin/shutdown -h now') + end, + shutdown_icon }, + { "Restart", + function() + awful.spawn('sudo /sbin/shutdown -r now') + end, + restart_icon }, + { "Logout", + function() + awesome.quit() + end, + logout_icon }, + { "Lock", + function() + awful.spawn("xscreensaver-command -lock") + end, + lock_icon } + } +shutdownMenu_launcher = awful.widget.launcher({ + image = beautiful.awesome_icon, + menu = awful.menu({ items = shutdownMenu_items}) }) + + -- {{{ Wibar -- Create a textclock widget mytextclock = wibox.widget.textclock() @@ -230,6 +262,7 @@ awful.screen.connect_for_each_screen(function(s) wibox.widget.systray(), mytextclock, s.mylayoutbox, + shutdownMenu_launcher, }, } end)