Skip to content

Instantly share code, notes, and snippets.

@haselwarter
Created September 5, 2021 11:25
Show Gist options
  • Save haselwarter/5e1b16bf6288a4a0376ca6480da4d6d6 to your computer and use it in GitHub Desktop.
Save haselwarter/5e1b16bf6288a4a0376ca6480da4d6d6 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
# Goal: move workspace $1 to the currently focused output, move the workspace on the current output
# to the output where $1 was.
# The workspace we want to end up on
dest_ws=$1
# The output where the destination ws resides
output_of_dest_ws=$(i3-msg -t get_workspaces | jq .[] | jq -r 'select(.name == "'$dest_ws'").output')
# The currently focused output
current_output=$(i3-msg -t get_workspaces | jq .[] | jq -r "select(.focused == true).output")
# The workspace on the current output
current_ws=$(i3-msg -t get_workspaces | jq .[] | jq -r "select(.focused == true).name")
# Send away the current workspace
i3-msg move workspace to output $output_of_dest_ws
# Select the destination workspace
i3-msg workspace $dest_ws
# Move the destination workspace to what was the current output in the beginning
i3-msg move workspace to output $current_output
# Re-activate the destination workspace
# sleep 0.2
i3-msg workspace $dest_ws
@budRich
Copy link

budRich commented Sep 12, 2021

@totoro-ghost Yeah I think i can brew up that monitor ws swapper thing in bash. Sounds useful and more sober then the xmonad workspace summoning shenanigans :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment