Hint: Don’t restart

To make changes in your autostart take effect immediately, just type
herbstclient reload. There is no need to restart herbstluftwm or X.

Even if you just updated you herbstluftwm-binary, there’s no need to restart
anything. Run herbstclient wmexec, which does an exec(3) on the new
herbstluftwm version. (You also can use wmexec to switch to another window
manager without restarting anything)

Hint: Use scripts!

There are a bunch of scripts coming along with herbstluftwm. Check out the
scripts directory in the sources and the examples directory after installing.

Hint: Understanding processes

To understand the relationship between the different processes that running
in a typical herbstluftwm setup, consider the following diagram:

As you can see, herbstclient does nothing except sending requests to
herbstluftwm. Whenever a process performs a fork-and-exec, the following
rules apply:

A child process inherits the environment variables of its parent
process. If you change an environment variable (like PATH), then it
will stay unchanged in the parent process.

⇒ If you want to set some environment variables for your complete
session (i.e. all processes) then you have to set it in your
~/.xinitrc.

If a process spawns a window, then the window will spawn delayed. This
delay differs from application to application (and from time to time).
So a script like

herbstclient spawn xterm
herbstclient spawn xev

does not guarantee that the xterm window will appear before the
xev window! It only guarantees that the xterm is executed before xev will
be executed.

⇒ If you want to apply some rules only for the next windows, then use a
bash-script like the one for temporary rules.

Q: Why is herbstluftwm called herbstluftwm?

I liked the name of the e-mail client wanderlust. Unfortunately I am a happy
mutt user, so I needed an other application with a similar name.

Q: Is herbstluftwm a fork of dwm/musca/wmii/…?

No. It was written from scratch, although it borrows some basic XLib function calls
(like updating numlock-state, sending a WMDelete-Message to a client,
updating the urgent hints, …) from dwm.

Q: If the config is a bash script, does it mean it is called on each keystroke?

No, the configuration file is executed once to set internal settings and
keybindings and so on. If a keybinding is registered and its key is pressed,
the according (internal) command directly is called.

Q: How can I let single clients float?

Not at all. You don’t need it. You have the power of manual tiling, so
there is no need to place clients manually by dragging. Even better:
You don’t even need to place them manually. Use a rule to place special
dialogs automatically when they appear. See the GIMP-Example for a good
example.

Q: But I use GIMP very often, how can I use it without floating?

Load a predefined layout to a gimp tag. Move the GIMP-Tool windows to the
left and right border and put the rest in the center. Add this to your
autostart:

Q: What about a layout for Instant Messaging applications (Gajim, Pidgin, …)?

A good layout for Instant Messaging applications looks as follows: One frame on
the left displays the buddy list/roster, consuming ~15% of the monitor space,
while the right side is used for the conversations. This can be configured
easily with herbstluftwm. The following example configures such a layout on tag
7 and creates the rules to automatically move Gajim’s windows to the right
frame:

For pidgin, the setup looks similar. In this case the buddy list is on the
right with a width of 20% of the monitor space. In addition to the above, the
buddy list will not receive input focus when it shows up:

Q: herbstclient is too long to type it in the shell

Use tab-completion! her<tab>c<tab> expands to herbstclient.
There is also a tab-completion for the herbstclient parameters. After
installing herbstluftwm, add this to your .bashrc:

source /etc/bash_completion.d/herbstclient-completion

(The tab-completion in zsh works out of the box with most zsh-configurations).

You also can add an alias for herbstclient:

alias hc='herbstclient'

Q: My rules seem to be messed up

Clear them with hc unrule -F and start over. It is recommended to do this
in the autostart file.

Q: I don’t like that my mplayervideo/inputdialogs get resized to full framesize

Add this to your autostartfile:

hc rule instance=<instance> pseudotile=on

You can request the instancename with xprop by clicking on the related window.
<instancename> is the first string in the line WM_CLASS(STRING) (for
mplayer that would be xv, for firefox dialogs it is Dialog).

Q: I set default_frame_layout to my favorite layout but it doesn’t work with the root frame/existing frames

Existing tags are not affected by a change of that variable (only new
ones), so be sure to set it before creating any tags. A current
workaround is to put hc split vertical 0.5; hc remove at the end in your
autostart file. You can also cycle_layout in existing tags.

Q: How can I start external panels correctly?

The cleanest solution to start the external EWMH panel (like xfce4-panel)
from the autostart and manually reserve some space for it. Also start
herbstclient instance that knows when to kill the panel again so that
there aren’t multiple instances when reloading the autostart multiple
times. Append the following code to your bash autostart (assuming the
panel needs 31 pixels at the bottom of monitor 0):

Q: I’m using a compositing manager like xcompmgr and get ugly artifacts when switching tags or splitting frames

You probably have an old version of herbstluftwm and frame_bg_transparent
enabled. Disable this setting and use frame_active_opacity and/or
frame_normal_opacity instead or upgrade to a current version.

Q: How can I keybind a simple "Run" dialog?

Install dmenu and keybind dmenu_run_hlwm by adding the following line to
your autostart file:

hc keybind $Mod-p spawn dmenu_run_hlwm

Note that $Mod-p is bound to pseudotile toggle in the default
autostart of herbstluftwm, so you either need to change that binding or
use a different one for spawn dmenu_run_hlwm.

Q: How can I have some of the tags on specific monitors only?

For each tag, save the desired monitor name or index in the tag’s attributes.
Before switching to another tag, check whether it has such an attribute, and if
so, switch to that monitor first. This is accomplished by the following code in
the autostart:

# Replace the default section for tags in your autostart by the following:
# This is the default tag section of the autostart, with a single change:
# In the use_index keybinding, check the presence of the my_monitor attribute,
# before focusing the desired tag.
hc rename default "${tag_names[0]}" || true
for i in ${!tag_names[@]} ; do
hc add "${tag_names[$i]}"
key="${tag_keys[$i]}"
if ! [ -z "$key" ] ; then
# first check if the tag is locked to some monitor.
# if so, first focus the monitor
hc keybind "$Mod-$key" \
chain , silent substitute M tags."$i".my_monitor \
focus_monitor M \
, use_index "$i"
hc keybind "$Mod-Shift-$key" move_index "$i"
fi
done
# Add a keybinding for locking the current tag to the monitor it is displayed
# on. This is done by safing the current monitor index in the my_monitor
# attribute of the focused tag. If the monitor has a (nonempty) name, use the
# monitor name instead of its index.
herbstclient keybind $Mod-t chain \
, new_attr string tags.focus.my_monitor \
, substitute M monitors.focus.index set_attr tags.focus.my_monitor M \
, try and \
. compare monitors.focus.name != "" \
. substitute M monitors.focus.name \
set_attr tags.focus.my_monitor M
# Add a keybinding for removing the lock
herbstclient keybind $Mod-Shift-t \
remove_attr tags.focus.my_monitor
# Statically define which tag should be send to which monitor
lock_tag_to_monitor() {
herbstclient chain \
, new_attr string tags.by-name."$1".my_monitor \
, set_attr tags.by-name."$1".my_monitor "$2"
}
# Already lock some of the tags to a monitor, for example:
# lock the second tag to the monitor with index 0
lock_tag_to_monitor 2 0

The usage is: adjust the lock_tag_to_monitor-lines in your autostart to
statically define which tag should be send to which monitor. Press Mod-t to
lock the focused tag to the monitor it is currently on. Press Mod-Shift-t to
release the locking and to allow the tag to be displayed on any monitor.

Q: How can I have a seperate list of tags per monitor?

As a solution: add the desired tags for each monitor and then configure the
keybindings s.t. the i’th key references the i’th tag of that monitor instead
of the i’th of all the tags. You can achieve this by replacing the section
"tags" and "cycle through tags" in the autostart by the following:

You should also set swap_monitors_to_get_tag to 0. Also consider the
following hint for shifting windows between monitors:

Q: How to navigate between monitors?

In order to switch focus between the monitors, use the usual direction based
focusing (the command focus). It either focuses a window on the current
monitor or the next monitor if the boundary is reached.

The analogous behaviour for shift is not implemented yet, so you need to
configure it in your autostart. In order to shift windows from monitor to
monitor, replace the usual usage of shift in your autostart by this one:

(or analogously with arrow keys instead of hjkl). Again, this shifts a
window to the next monitor if the monitor boundary is reached.

Q: How do I detect whether it is the first time that autostart is executed?

If you want to actually autostart applications on herbstluftwm startup, one
needs to take care that they are not executed on successive reloads. The
following command returns success on the first time, autostart is executed, and
failure on successive calls:

herbstclient silent new_attr bool my_not_first_autostart

It tries to create a new attribute (on the root object). If it is the first
autostart run, then this succeeds. On any successive execution, this command
fails, because the attribute my_not_first_autostart already exists.
An example looks as follows: