dotfiles/config/i3/swap-workspaces.sh
2020-03-04 13:27:36 +01:00

19 lines
822 B
Bash
Executable file

#!/bin/bash
workspaces=$(swaymsg -t get_workspaces | jq -r '.[].name')
first=$(echo "$workspaces" | bemenu -i -p 'First workspace')
second=$(echo "$workspaces" | grep -v "$first" | bemenu -i -p 'Second workspace')
echo "'$first ' | '$second '"
first_number=$(echo "$first" | cut -d':' -f1)
second_number=$(echo "$second" | cut -d':' -f1)
first_name=$(echo "$first" | cut -d':' -f2)
second_name=$(echo "$second" | cut -d':' -f2)
temp=$RANDOM
echo "RENAMING FIRST ($first_number) TO TEMP"
swaymsg rename workspace number "$first_number" to "$second_name"
echo "RENAMING SECOND ($second_number) TO $first_number"
swaymsg rename workspace number "$second_number" to "$first_number:$second_name"
echo "RENAMING FIRST ($first_number) TO $second_number"
swaymsg rename workspace "$second_name" to "$second_number:$first_name"