mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-05-11 17:35:57 +08:00
awesome: Automatically determine whether systemctl or loginctl should be used in exit_screen
This commit is contained in:
parent
02345f2723
commit
5c1a1e8c0b
1 changed files with 6 additions and 4 deletions
|
|
@ -1,20 +1,22 @@
|
|||
local awful = require("awful")
|
||||
local naughty = require("naughty")
|
||||
|
||||
local ctl_var = "\"$(command -v systemctl >/dev/null && echo systemctl || echo loginctl)\""
|
||||
|
||||
local exit_screen = {}
|
||||
exit_screen.commands = {
|
||||
poweroff = function ()
|
||||
awful.spawn.with_shell("loginctl poweroff")
|
||||
awful.spawn.with_shell(ctl_var.." poweroff")
|
||||
end,
|
||||
reboot = function ()
|
||||
awful.spawn.with_shell("loginctl reboot")
|
||||
awful.spawn.with_shell(ctl_var.." reboot")
|
||||
end,
|
||||
suspend = function ()
|
||||
lock_screen_show()
|
||||
awful.spawn.with_shell("loginctl suspend")
|
||||
awful.spawn.with_shell(ctl_var.." suspend")
|
||||
end,
|
||||
hibernate = function ()
|
||||
awful.spawn.with_shell("loginctl hibernate")
|
||||
awful.spawn.with_shell(ctl_var.." hibernate")
|
||||
end,
|
||||
exit = function ()
|
||||
awesome.quit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue