diff --git a/modules/services/window-managers/herbstluftwm.nix b/modules/services/window-managers/herbstluftwm.nix index 67457e95a..51fe22bd0 100644 --- a/modules/services/window-managers/herbstluftwm.nix +++ b/modules/services/window-managers/herbstluftwm.nix @@ -29,6 +29,8 @@ let settingType = lib.types.oneOf [ lib.types.bool lib.types.int lib.types.str ]; + escapedTags = map lib.escapeShellArg cfg.tags; + in { meta.maintainers = [ lib.hm.maintainers.olmokramer ]; @@ -147,15 +149,14 @@ in { ${renderSettings cfg.settings} ${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 + for tag in ${lib.concatStringsSep " " escapedTags}; do herbstclient add "$tag" done + + if ${cfg.package}/bin/herbstclient object_tree tags.by-name.default &>/dev/null; then + herbstclient use ${lib.head escapedTags} + herbstclient merge_tag default ${lib.head escapedTags} + fi ''} ${renderKeybinds cfg.keybinds} diff --git a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart index 5f101e0bb..78d4d7d56 100644 --- a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart @@ -20,14 +20,15 @@ herbstclient set frame_bg_active_color '#000000' herbstclient set frame_gap '12' herbstclient set frame_padding '-12' -if @herbstluftwm@/bin/herbstclient object_tree tags.default &>/dev/null; then - herbstclient rename default '1' -fi - for tag in '1' 'with space' 'wə1rd#ch@rs'\'''; do herbstclient add "$tag" done +if @herbstluftwm@/bin/herbstclient object_tree tags.by-name.default &>/dev/null; then + herbstclient use '1' + herbstclient merge_tag default '1' +fi + herbstclient keybind Mod4-1 use 1 herbstclient keybind Mod4-2 use 2