Last active
March 6, 2024 11:09
-
-
Save fbrinker/df9cfbc84511d807f45041737ff3ea02 to your computer and use it in GitHub Desktop.
Swap i3 displays / workspaces between displays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# requires jq | |
DISPLAY_CONFIG=($(i3-msg -t get_outputs | jq -r '.[]|"\(.name):\(.current_workspace)"')) | |
for ROW in "${DISPLAY_CONFIG[@]}" | |
do | |
IFS=':' | |
read -ra CONFIG <<< "${ROW}" | |
if [ "${CONFIG[0]}" != "null" ] && [ "${CONFIG[1]}" != "null" ]; then | |
echo "moving ${CONFIG[1]} right..." | |
i3-msg -- workspace --no-auto-back-and-forth "${CONFIG[1]}" | |
i3-msg -- move workspace to output right | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have taken a stab at re-writing this based on all the examples above. The behaviour I expect is:
Notable changes I've made:
next
token which works with horizontally and vertically arranged monitors.