mirror of
https://github.com/nix-community/home-manager
synced 2024-12-24 10:49:48 +01:00
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:
parent
e7eba9cc46
commit
1a0a5f5037
6 changed files with 66 additions and 11 deletions
|
@ -145,15 +145,17 @@ in {
|
||||||
|
|
||||||
${renderSettings cfg.settings}
|
${renderSettings cfg.settings}
|
||||||
|
|
||||||
if ${cfg.package}/bin/herbstclient object_tree tags.by-name | ${pkgs.gnugrep}/bin/grep default; then
|
${lib.optionalString (cfg.tags != [ ]) ''
|
||||||
herbstclient rename default ${
|
if ${cfg.package}/bin/herbstclient object_tree tags.default &>/dev/null; then
|
||||||
lib.escapeShellArg (builtins.head cfg.tags)
|
herbstclient rename default ${
|
||||||
}
|
lib.escapeShellArg (builtins.head cfg.tags)
|
||||||
fi
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
for tag in ${lib.escapeShellArgs cfg.tags}; do
|
for tag in ${lib.escapeShellArgs cfg.tags}; do
|
||||||
herbstclient add "$tag"
|
herbstclient add "$tag"
|
||||||
done
|
done
|
||||||
|
''}
|
||||||
|
|
||||||
${renderKeybinds cfg.keybinds}
|
${renderKeybinds cfg.keybinds}
|
||||||
|
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{ herbstluftwm-simple-config = ./herbstluftwm-simple-config.nix; }
|
{
|
||||||
|
herbstluftwm-simple-config = ./herbstluftwm-simple-config.nix;
|
||||||
|
herbstluftwm-no-tags = ./herbstluftwm-no-tags.nix;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/nix/store/00000000000000000000000000000000-bash/bin/bash
|
||||||
|
shopt -s expand_aliases
|
||||||
|
|
||||||
|
# shellcheck disable=SC2142
|
||||||
|
alias herbstclient='set -- "$@" ";"'
|
||||||
|
set --
|
||||||
|
|
||||||
|
herbstclient emit_hook reload
|
||||||
|
|
||||||
|
# Reset everything.
|
||||||
|
herbstclient attr theme.tiling.reset 1
|
||||||
|
herbstclient attr theme.floating.reset 1
|
||||||
|
herbstclient keyunbind --all
|
||||||
|
herbstclient unrule --all
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
herbstclient unlock
|
||||||
|
|
||||||
|
@herbstluftwm@/bin/herbstclient chain ";" "$@"
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
xsession.windowManager.herbstluftwm = { enable = true; };
|
||||||
|
|
||||||
|
test.stubs.herbstluftwm = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
autostart=home-files/.config/herbstluftwm/autostart
|
||||||
|
assertFileExists "$autostart"
|
||||||
|
assertFileIsExecutable "$autostart"
|
||||||
|
|
||||||
|
normalizedAutostart=$(normalizeStorePaths "$autostart")
|
||||||
|
assertFileContent "$normalizedAutostart" ${./herbstluftwm-no-tags-autostart}
|
||||||
|
'';
|
||||||
|
}
|
|
@ -19,7 +19,7 @@ herbstclient set frame_bg_active_color '#000000'
|
||||||
herbstclient set frame_gap '12'
|
herbstclient set frame_gap '12'
|
||||||
herbstclient set frame_padding '-12'
|
herbstclient set frame_padding '-12'
|
||||||
|
|
||||||
if @herbstluftwm@/bin/herbstclient object_tree tags.by-name | /nix/store/00000000000000000000000000000000-gnugrep/bin/grep default; then
|
if @herbstluftwm@/bin/herbstclient object_tree tags.default &>/dev/null; then
|
||||||
herbstclient rename default '1'
|
herbstclient rename default '1'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ for tag in '1' 'with space' 'wə1rd#ch@rs'\'''; do
|
||||||
herbstclient add "$tag"
|
herbstclient add "$tag"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
herbstclient keybind Mod4-1 use 1
|
herbstclient keybind Mod4-1 use 1
|
||||||
herbstclient keybind Mod4-2 use 2
|
herbstclient keybind Mod4-2 use 2
|
||||||
herbstclient keybind Mod4-Alt-Tab cycle -1
|
herbstclient keybind Mod4-Alt-Tab cycle -1
|
|
@ -39,6 +39,8 @@
|
||||||
assertFileIsExecutable "$autostart"
|
assertFileIsExecutable "$autostart"
|
||||||
|
|
||||||
normalizedAutostart=$(normalizeStorePaths "$autostart")
|
normalizedAutostart=$(normalizeStorePaths "$autostart")
|
||||||
assertFileContent "$normalizedAutostart" ${./autostart}
|
assertFileContent "$normalizedAutostart" ${
|
||||||
|
./herbstluftwm-simple-config-autostart
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue