39 lines
818 B
Lua
39 lines
818 B
Lua
|
local function shutdown(confirm_prompt)
|
||
|
if (string.lower(confirm_prompt) == "y") or (string.lower(confirm_prompt) == "yes") then
|
||
|
awful.spawn("shutdown now", false)
|
||
|
elseif (string.lower(confirm_prompt) == "r") or (string.lower(confirm_prompt) == "reset") then
|
||
|
awful.spawn("shutdown -r now", false)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
return gears.table.join(
|
||
|
awful.key( {"Mod4"}, "p",
|
||
|
function ()
|
||
|
awful.prompt.run {
|
||
|
prompt = "<b>Really shutdown? (y/n/r) </b>",
|
||
|
textbox = awful.screen.focused().mypromptbox.widget,
|
||
|
exe_callback = shutdown
|
||
|
}
|
||
|
end,
|
||
|
{
|
||
|
description = "Shutdown",
|
||
|
group = "System"
|
||
|
}
|
||
|
),
|
||
|
|
||
|
|
||
|
|
||
|
awful.key( {"Mod4", "Control"}, "x",
|
||
|
function ()
|
||
|
-- requires sudoers rule
|
||
|
awful.spawn("sudo systemctl restart lightdm")
|
||
|
end,
|
||
|
|
||
|
{
|
||
|
description = "Restart lightdm",
|
||
|
group = "System"
|
||
|
}
|
||
|
)
|
||
|
)
|