aboutsummaryrefslogtreecommitdiffstats
path: root/.config/herbstluftwm/switcher.sh
blob: 255830363bfb6bff758f958fc9e584985858dd22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env zsh

source ~/.config/init/vars

typeset -i choice
nums=()
lines=""
while read -rA line; do
	nums=( "${nums[@]}" "${line[1]}" )
	if [[ -z "$lines" ]]; then
		lines="${line[@]:3}"
	else
		lines="${lines}\n${line[@]:3}"
	fi
done < <(wmctrl -l)

echo -e "$lines" | nl -w 2 -s ") " | dmenu -fn "${bfont}:size=${bfont_size}" -i -h "$bheight" \
		-nb "$bar_bg" -nf "$bar_fg" -sb "$bg_focus" -sf "$fg_focus" \
		-p "Select:" -l 40 | cut -d ')' -f 1 | read choice

herbstclient jumpto "${nums[$choice]}"