I believe that AwesomeWM autorun programs are better when done well
Why = If you exit one of your autorun *always" programs and want to restart them you (a) restart X [closing everything in the process], (b) relaunch them from a shell [output messages now go to that shell], (c) create special re-launch code in rc.lua [on top of the launch code you put in .xinitrc
How = This works well for me...
a) As soon after the debug lines in rc.lua add...
local gears = { table = require( "gears.table" ) ,
p_call = require( "gears.protected_call" ) }
gears.p_call( dofile, path_this .. "runonce.lua" )
b) And here's the "when done well" part (IMHO) that is in runonce.lua...
local naughty = require( "naughty" )
local awful = { spawn = require( "awful.spawn" ) }
local string = { sub = string.sub ,
find = string.find ,
format = string.format }
-- This function makes sure the application is not restarted when awesome is reloaded
local function run_once( command )
local args_start = string.find( command, " " )
local pgrep_name = args_start and command:sub( 0, args_start - 1 ) or command
local command = "pgrep -u $USER -x " .. pgrep_name .. " > /dev/null || (" .. command .. ")"
awful.spawn.easy_async_with_shell(
command,
function( stdout, stderr, exitreason, exitcode )
if exitcode ~= 0 then
naughty.notify({
preset = naughty.config.presets.critical ,
text = string.format( "%s\n\n%s\n%s\n%s\n%s",
command,
stdout,
stderr,
exitreason,
exitcode ) })
end
end )
end
-- Start these if not already running
run_once( "guake &> /dev/null" )
run_once( "remmina -i &> /dev/null" )
run_once( "skypeforlinux" )
Why I believe it is done well...
1) Works with programs that have parameters [only searches for the name, not the args]
2) Has an alert if things go wrong [without killing Awesome]
3) Only edit the bottom section
Finally...
mod+ctrl+r reloads awesome [nothing really changes, just resets memmory] and of course the apps you always want are re-launched exactly the same way they were the first time