User Tools

Site Tools


autostart

./autostart

From the man page (http://wwwcip.cs.fau.de/~re06huxa/herbstluftwm/herbstluftwm.html):

There is no configuration file but an autostart file, which is executed on startup. It is also executed on command reload. If not specified by the –autostart argument, autostart file is located at $XDG_CONFIG_HOME/herbstluftwm/autostart or at ~/.config/herbstluftwm/autostart. Normally it consists of a few herbstclient calls. If executing the autostart file in a user’s home fails the global autostart file (mostly placed at /etc/xdg/herbstluftwm/autostart) is executed as a fallback.

For a quick install, copy the default autostart file to ~/.config/herbstluftwm/.

improving autostart execution time

In many cases, (depending on the complexity of your autostart), you can improve the execution time of your autostart script by chain-ing the commands together into a single call to herbstclient, without heavy modification to your autostart. (Instead of calling herbstclient for each keybind, setting and rule):

#! /bin/bash
# $XDG_CONFIG_HOME/herbstluftwm/autostart

# First, replace the function 'hc' from this:

# function hc() {
#     herbstclient "$@"
# }

### with this: ###

# this will append all commands to an array called $cmds
cmds=()

function hc() {
  cmds+=(";" "$@")
}

# ...Continue as normal...
hc emit_hook reload

# remove all existing keybindings
hc keyunbind --all

Then right before you spawn your panel:

# unlock, just to be sure
hc unlock

# ...right here...
### Execute the chained commands ###

herbstclient chain "${cmds[@]}" &

# The ampersand is optional, but will allow the panels to be started sooner
# ...then continue...



# Find the panel
panel=~/.config/herbstluftwm/panel.sh
[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
    # start it on each monitor
    $panel $monitor &
done
autostart.txt · Last modified: 2013/12/05 11:05 by tg