Use zsh for herbstluftwm's autostart

This commit is contained in:
Tom Willemse 2016-07-25 22:28:41 +02:00
parent e3f1a5feea
commit f43b572693

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env zsh
## Helper functions: ## Helper functions:
@ -133,20 +133,24 @@ hc keybind $Mod-u jumpto urgent
## Tags: ## Tags:
tag_names=( dev web {3..10} ) tag_names=( dev web {3..10} )
tag_indexes=( {1..${#tag_names}} )
tag_keys=( bracketleft braceleft braceright parenleft equal tag_keys=( bracketleft braceleft braceright parenleft equal
asterisk parenright plus bracketright exclam ) asterisk parenright plus bracketright exclam )
hc rename default "${tag_names[0]}" || true hc rename default "${tag_names[1]}" || true
for i in "${!tag_names[@]}"; do for i in $tag_indexes; do
hc add "${tag_names[$i]}" hc add "${tag_names[$i]}"
key="${tag_keys[$i]}" key="${tag_keys[$i]}"
if ! [ -z "$key" ] ; then if ! [ -z "$key" ] ; then
# ZSH array indexes start at 1, herbstluftwm tag indexes start
# at zero, so subtract one to match them.
j=$(( $i - 1 ))
# first check if the tag is locked to some monitor. # first check if the tag is locked to some monitor.
# if so, first focus the monitor # if so, first focus the monitor
hc keybind "$Mod-$key" chain \ hc keybind "$Mod-$key" chain \
, silent substitute M tags."$i".my-monitor focus_monitor M \ , silent substitute M tags."$j".my-monitor focus_monitor M \
, use_index "$i" , use_index "$j"
hc keybind "$Mod-Shift-$key" move_index "$i" hc keybind "$Mod-Shift-$key" move_index "$j"
fi fi
done done