This repository has been archived on 2024-04-30. You can view files and clone it, but cannot push or open issues or pull requests.
setup/roles/i3/files/scripts/empty_ws.sh

27 lines
416 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
wss=`i3-msg -t get_workspaces | tr , '\n' | grep num | cut -d : -f 2 | sort -n`
nextwss=()
for ws in $wss; do
((ws=$ws+1))
nextwss+=( "$ws" )
done
for nextws in ${nextwss[@]}; do
exists=false
for ws in $wss; do
if [[ $ws -eq $nextws ]]; then
exists=true
break
fi
done
if [ $exists = false ]; then
newws=$nextws
break
fi
done
i3-msg workspace $newws