From 5c1a1e8c0b50cbf643703750b78bba4333123380 Mon Sep 17 00:00:00 2001 From: elenapan Date: Fri, 4 Jul 2025 08:43:31 +0300 Subject: [PATCH] awesome: Automatically determine whether systemctl or loginctl should be used in exit_screen --- config/awesome/elemental/exit_screen/init.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config/awesome/elemental/exit_screen/init.lua b/config/awesome/elemental/exit_screen/init.lua index 78fe5b2..d6e43e4 100644 --- a/config/awesome/elemental/exit_screen/init.lua +++ b/config/awesome/elemental/exit_screen/init.lua @@ -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()