27 lines
416 B
Bash
Executable file
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
|