Add shutdown menu

This commit is contained in:
Arkhist 2019-07-23 17:30:45 +02:00
parent 4fa6d66d84
commit b274ce9c2b
5 changed files with 37 additions and 0 deletions

1
icons/lock.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-lock"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>

After

Width:  |  Height:  |  Size: 321 B

1
icons/log-out.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>

After

Width:  |  Height:  |  Size: 367 B

1
icons/power.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-power"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg>

After

Width:  |  Height:  |  Size: 308 B

1
icons/refresh-cw.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-refresh-cw"><polyline points="23 4 23 10 17 10"></polyline><polyline points="1 20 1 14 7 14"></polyline><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path></svg>

After

Width:  |  Height:  |  Size: 400 B

33
rc.lua
View File

@ -121,6 +121,38 @@ kbdlayout.switch = function()
os.execute( config.kbSwitchCmd .. " " .. t ) os.execute( config.kbSwitchCmd .. " " .. t )
end 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 -- {{{ Wibar
-- Create a textclock widget -- Create a textclock widget
mytextclock = wibox.widget.textclock() mytextclock = wibox.widget.textclock()
@ -230,6 +262,7 @@ awful.screen.connect_for_each_screen(function(s)
wibox.widget.systray(), wibox.widget.systray(),
mytextclock, mytextclock,
s.mylayoutbox, s.mylayoutbox,
shutdownMenu_launcher,
}, },
} }
end) end)