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:
parent
218503b691
commit
64d1f75a1e
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue