switchworkspace 580 Bytes
Newer Older
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
#!/bin/bash 
 
# check have a delta argument
if [ -z "$1" ]; then
    echo "Please provide a number of seconds to switch desktops as first argument"
    exit 128
fi
 
if [ "$1" -lt 3 ]; then
    echo "Please provide a number of seconds >= 3"
    exit 128
fi
 
# init
numDesktops=2
desktop=$(xdotool get_desktop);
 
echo "Press Crtl+C or kill this script to stop the switching"
echo "Fist switch will occur in $1 seconds..."
while true 
do 
    sleep $1
    # change desktop
    desktop=$((desktop + 1))
    desktop=$((desktop % numDesktops))
    xdotool set_desktop $desktop
done