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 ) --]]