1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

herbstluftwm: fix default tag renaming

The previous implementation tried to rename the tag named "default" to
the first tag in `cfg.tags`. This was a wrong approach because if a
tag with the same name already existed, the renaming failed and the
default tag would continue to exist.

The looking up of the default tag also contained a bug because it
should have used `by-name` in the path.
This commit is contained in:
Olmo Kramer 2023-01-20 20:17:55 +01:00 committed by Robert Helgesson
parent 218503b691
commit 64d1f75a1e
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 13 additions and 11 deletions

View file

@ -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}

View file

@ -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