herbstluftwm: Fix error when no tags set

The default value for `xsession.windowManager.herbstluftwm.tags` is an
empty list, but the config file uses `builtins.head` on it, which causes
an error upon evaluation. With this change the tags configuration is
skipped if the list is empty.
This commit is contained in:
Olmo Kramer 2022-12-19 22:08:33 +01:00
parent e7eba9cc46
commit 1a0a5f5037
No known key found for this signature in database
GPG key ID: BE09591F4AB66337
6 changed files with 66 additions and 11 deletions

View file

@ -145,15 +145,17 @@ in {
${renderSettings cfg.settings}
if ${cfg.package}/bin/herbstclient object_tree tags.by-name | ${pkgs.gnugrep}/bin/grep default; then
herbstclient rename default ${
lib.escapeShellArg (builtins.head cfg.tags)
}
fi
${lib.optionalString (cfg.tags != [ ]) ''
if ${cfg.package}/bin/herbstclient object_tree tags.default &>/dev/null; then
herbstclient rename default ${
lib.escapeShellArg (builtins.head cfg.tags)
}
fi
for tag in ${lib.escapeShellArgs cfg.tags}; do
herbstclient add "$tag"
done
for tag in ${lib.escapeShellArgs cfg.tags}; do
herbstclient add "$tag"
done
''}
${renderKeybinds cfg.keybinds}