Created
September 5, 2021 11:25
-
-
Save haselwarter/5e1b16bf6288a4a0376ca6480da4d6d6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/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 |
@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
@budRich can you help me convert my python script to bash too, it is for following case,
i have two monitors, and when i press a keybind
i want to move workspace on unfocused output to focused one and
the workspace on focused output to unfoucsed one
i gave my script for swapping, it's not same as yours, i was just giving a example of how i use the ipc-python
this is the script which works same as your one, ans yes it is slow than the bash one, that's why i want to convert my one to the bash one