Skip to content

Instantly share code, notes, and snippets.

@koenhendriks
Created November 26, 2022 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koenhendriks/7004a947cdf29d8b333892c871e8e293 to your computer and use it in GitHub Desktop.
Save koenhendriks/7004a947cdf29d8b333892c871e8e293 to your computer and use it in GitHub Desktop.
Workspace switcher from CLI for CInnamon
#!/usr/bin/env bash
current=`xdotool get_desktop`
max=`xdotool get_num_desktops`
if [ "$1" = "left" ]; then
desktop=`expr $current - 1`
elif [ "$1" = "right" ]; then
desktop=`expr $current + 1`
else
echo "Invalid argument, should be either 'left' or 'right' ";
exit 2;
fi
if [ $desktop -le $max ] && [ $desktop -ge 0 ]; then
xdotool set_desktop $desktop
fi
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment