add script to switch to empty workspace
This commit is contained in:
parent
d4f3467519
commit
8ffd9be387
2 changed files with 29 additions and 0 deletions
|
@ -178,3 +178,5 @@ mode "$mode_apps" {
|
|||
bindsym Escape mode "default"
|
||||
bindsym Return mode "default"
|
||||
}
|
||||
|
||||
bindsym $mod+grave exec --no-startup-id ~/.config/i3/scripts/empty_ws.sh
|
||||
|
|
27
roles/i3/files/scripts/empty_ws.sh
Executable file
27
roles/i3/files/scripts/empty_ws.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/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
|
Reference in a new issue