#!/bin/sh WORKSPACES=~/.config/i3/workspaces if [ -z $1 ]; then for fic in ~/.config/i3/workspaces/*.json; do echo $(basename "$fic" .json) done exit 0 else i3-msg "workspace $1; append_layout ${WORKSPACES}/${1}.json; workspace back_and_forth" > /dev/null # get the list of windows on the current workspace WINDOWS=$(xdotool search --all --onlyvisible --desktop $(xprop -notype -root _NET_CURRENT_DESKTOP | cut -c 24-) "" 2>/dev/null) for window in $WINDOWS; do HAS_PID=$(xdotool getwindowpid $window 2>&1 | grep "pid" | wc -l) #if [ ! $HAS_PID -eq 0 ]; then # echo "$window does not have a process" #else xdotool windowunmap $window xdotool windowmap $window #fi done exit 1 fi