#!/bin/bash # Switch workspace between a specified primary one and the current one. PRIMARY=0 CURRENT=$(wmctrl -d | grep \* | cut -d " " -f1) SAVE_FILE=/tmp/current-workspace if [ "$CURRENT" = "$PRIMARY" ] && [ -e "$SAVE_FILE" ]; then wmctrl -s $(cat "$SAVE_FILE") else echo "$CURRENT" > "$SAVE_FILE" wmctrl -s $PRIMARY fi