From b4f7f23eef9a73aa0c0f20ba2a51aeddcb826e4b Mon Sep 17 00:00:00 2001 From: Crescent617 Date: Thu, 6 Jul 2023 08:57:45 +0800 Subject: [PATCH] fix autostart --- rc.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/rc.lua b/rc.lua index 59d3882..feedd2a 100644 --- a/rc.lua +++ b/rc.lua @@ -63,16 +63,21 @@ end -- {{{ Autostart windowless processes -- This function will run once every time Awesome is started -awful.spawn.once(string.format("sh -c 'cd %s && ls | xargs -n1 gio launch'", os.getenv "HOME" .. "/.config/autostart")) --- awful.spawn.once "picom" +local function run_once(cmd_arr) + for _, cmd in ipairs(cmd_arr) do + awful.spawn.with_shell(string.format("pgrep -fx '%s' > /dev/null || (%s)", cmd, cmd)) + end +end + +run_once { "compton" } -- comma-separated entries -- This function implements the XDG autostart specification ---[[ +--[ awful.spawn.with_shell( - 'if (xrdb -query | grep -q "^awesome\\.started:\\s*true$"); then exit; fi;' .. - 'xrdb -merge <<< "awesome.started:true";' .. + 'if (xrdb -query | grep -q "^awesome\\.started:\\s*true$"); then exit; fi;' + .. 'xrdb -merge <<< "awesome.started:true";' -- list each of your autostart commands, followed by ; inside single quotes, followed by .. - 'dex --environment Awesome --autostart --search-paths "$XDG_CONFIG_DIRS/autostart:$XDG_CONFIG_HOME/autostart"' -- https://github.com/jceb/dex + .. 'dex --environment Awesome --autostart --search-paths "$XDG_CONFIG_DIRS/autostart:$XDG_CONFIG_HOME/autostart"' -- https://github.com/jceb/dex ) --]]