aboutsummaryrefslogtreecommitdiff
path: root/scripts/scripts/wscycle.sh
blob: 7ea608d22eb25cdd2ab54ca12098fb3139a501f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
# cycle through workspaces

# get the current ws
ws=$( xprop -root _NET_CURRENT_DESKTOP | sed -e 's/_NET_CURRENT_DESKTOP(CARDINAL) = //' )
total=5

while getopts fr options
do
	case $options in
		f)
			if [[ $ws -eq $total ]]
			then
				wmctrl -s 0
			else
				ws=$(( $ws + 1 ))
				wmctrl -s $ws
			fi
			;;
		r)
			if [[ $ws -eq 0 ]]
			then
				wmctrl -s $total
			else
				ws=$(( $ws - 1 ))
				wmctrl -s $ws
			fi
			;;
	esac
done