Warning
|
I don’t use this module as I moved to Gnome and Gdm. Feel free to fork. |
autostart made easy
Awesome WM is a window manager and no more. This
module strives to provide a comfortable way to manage applications which
should be started automatically when one opens a new awesome
session.
Usually, what most users want is to define a list of system tray
applications that should be started when running startx
. Most people are
satisfied with putting those shell commands in ~/.xprofile
. However, this has
some drawbacks:
-
No notifications when a program exits unexpectedly.
-
The
STDOUT
of the programs is naturally printed in the tty from whichstartx
was invoked, meaning there’s no native support for log files / desktop notifications for messages which those programs usually print to the tty’sSTDERR
. -
Sometimes, applications are written in such a way that if Awesome is restarted, the sys tray icon disappears. But if you restart them after Awesome has restarted, you do see the tray icon. With
~/.xprofile
This is not possible unless you construct hacky bash scripts. -
Sometimes, programs don’t exit if they were started from
~/.xprofile
, one example I’m aware of is Redshift-gtk.
Awesome-autostart strives to solve these issues by putting these programs under awesome’s control.
Import the module to your rc.lua
:
local Autostart = require('autostart')
Now use it like this:
local autostart_config = {
programs = {
{
-- Whether to delay the start of the program after awesome starts
delay = 1,
-- You don't have to use a full path here, it's only for illustration
bin = {'/usr/bin/polybar', 'default'},
},
{
bin = {'/usr/bin/redshift-gtk'}
},
},
log = {
handler = function (self, level, nessage)
naughty.notify({
preset = naughty.config.presets.critical,
title = "Autostart module " .. level .. "::",
timeout = 10,
text = message
})
end,
settings = {
init_level = "ERROR"
}
}
}
-- It is recommended to put this right after all the widgets, the tags and the
-- `tasklist` are set.
autostart = Autostart:new(autostart_config)
autostart:run_all()
Most of what’s examplified in the usage section I think is self explanatory.
But the log
configuration key is worth perhaps a bit more explanation:
The handler
key is expecting a function that is passed to
lua-logger which is essentially an
appender function, so a bit more details are explained
here.
Similarly, the settings
table is passed to
lua-logger and it is explained
here.