From f43b572693a5d5db1462bc1eec46db8eadea8187 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 25 Jul 2016 22:28:41 +0200 Subject: Use zsh for herbstluftwm's autostart --- herbstluftwm/.config/herbstluftwm/autostart | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'herbstluftwm/.config') diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart index e79d3c9..f84b9a3 100755 --- a/herbstluftwm/.config/herbstluftwm/autostart +++ b/herbstluftwm/.config/herbstluftwm/autostart @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh ## Helper functions: @@ -133,20 +133,24 @@ hc keybind $Mod-u jumpto urgent ## Tags: tag_names=( dev web {3..10} ) +tag_indexes=( {1..${#tag_names}} ) tag_keys=( bracketleft braceleft braceright parenleft equal asterisk parenright plus bracketright exclam ) -hc rename default "${tag_names[0]}" || true -for i in "${!tag_names[@]}"; do +hc rename default "${tag_names[1]}" || true +for i in $tag_indexes; do hc add "${tag_names[$i]}" key="${tag_keys[$i]}" 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. # if so, first focus the monitor hc keybind "$Mod-$key" chain \ - , silent substitute M tags."$i".my-monitor focus_monitor M \ - , use_index "$i" - hc keybind "$Mod-Shift-$key" move_index "$i" + , silent substitute M tags."$j".my-monitor focus_monitor M \ + , use_index "$j" + hc keybind "$Mod-Shift-$key" move_index "$j" fi done -- cgit v1.2.3-54-g00ecf