Swap two workspaces on same monitor #3202
Unanswered
austinliuigi
asked this question in
Q&A
Replies: 1 comment
-
|
I second this, it would be very nice to have. #!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <target_workspace>"
exit 1
fi
TARGET_WORKSPACE="$1"
CURRENT_WORKSPACE=$(hyprctl -j activeworkspace | jq -r '.id')
TEMP_WORKSPACE="9999"
# Get all window addresses on current workspace
CURRENT_WINDOWS=$(hyprctl -j clients | jq -r ".[] | select(.workspace.id==$CURRENT_WORKSPACE) | .address")
# Get all window addresses on target workspace
TARGET_WINDOWS=$(hyprctl -j clients | jq -r ".[] | select(.workspace.id==$TARGET_WORKSPACE) | .address")
# Move all windows from current workspace to temporary workspace
for window in $CURRENT_WINDOWS; do
hyprctl dispatch movetoworkspacesilent "$TEMP_WORKSPACE,address:$window"
done
# Move all windows from target workspace to current workspace
for window in $TARGET_WINDOWS; do
hyprctl dispatch movetoworkspacesilent "$CURRENT_WORKSPACE,address:$window"
done
# Move all windows from temporary workspace to target workspace (iterate backwards to preserve order)
TEMP_WINDOWS=$(hyprctl -j clients | jq -r ".[] | select(.workspace.id==$TEMP_WORKSPACE) | .address")
for window in $(echo "$TEMP_WINDOWS" | tac); do
hyprctl dispatch movetoworkspacesilent "$TARGET_WORKSPACE,address:$window"
done
# Switch to the target workspace
hyprctl dispatch workspace "$TARGET_WORKSPACE"but it would be nice to support it natively to preserve layout better |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I couldn't find a dispatcher that swaps two workspaces. Windows can be swapped via
movewindowand monitors viaswapactiveworkspaces. Is swapping workspaces unavailable at the moment or did I miss something in the documentation?Thanks
Beta Was this translation helpful? Give feedback.
All reactions