-
Notifications
You must be signed in to change notification settings - Fork 24
autostart
It can be desirable to launch certain programs automatically alongside the window manager when it starts up.
For this there is the autostart
configuration option which as per the default configuration has
a simple example of starting the st
terminal automatically when the window manager starts.
static const char *const autostart[] = {
// "st", NULL,
NULL /* terminate */
};
static const char *const autorestart[] = {
NULL /* terminate */
};
The commands from both arrays are executed using execvp()
and any command line arguments must be
added as separate strings rather than a single string that contains spaces.
Here is an example of starting a compositor:
static const char *const autostart[] = {
"picom", "--experimental-backends", "--blur-method", "dual_kawase", "--blur-strength", "5", "-b", NULL,
NULL /* terminate */
};
Should you need to execute shell commands then you will need to prefix them with "sh", "-c"
(or
another shell as needed).
The window manager keeps will only start programs defined in the autostart
array during the
initial startup. The programs will not be spawned again when restarting, thus any
changes to this array will not result in new programs to be launched when restarting the window
manager. This is in contrast to the autorestart
array which holds commands that are only executed
following a restart of the window manager.
That said some scripts are better placed in your ~/.xinitrc
file if you use startx
to start your
window manager or in ~/.xsession
or ~/.xprofile
if you are using a login manager.
For example in a multi-monitor setup you may want to run xrandr
to arrange the monitors before
the window manager starts up for a smoother experience.
Back to Configuration > System.
Concepts | Configuration | Features | Flags | Functionality | Functions