Cycle the current workspace between all available outputs
Make sway-cycle-workspace executeable and place it in your PATH.
Put this to bind it to a hotkey in your sway config
bindsym $mod+q exec "sway-cycle-workspace"
#!/bin/sh | |
# dependencies: | |
# - jq (pacman -S jq, apt install jq, etc) | |
outputs_json=$(swaymsg -t get_outputs) | |
num_outputs=$(echo "$outputs_json" | jq 'length') | |
focused_output_index=$(echo "$outputs_json" | jq '[.[].focused] | index(true)') | |
next_output_index=$(("$focused_output_index" + 1)) | |
max_output_index=$(("$num_outputs" - 1)) | |
if [ "$next_output_index" -gt "$max_output_index" ]; then | |
next_output_index=0 | |
fi | |
next_output_name=$(echo "$outputs_json" | jq -r ".[$next_output_index].name") | |
swaymsg move workspace to "$next_output_name" |
Cycle the current workspace between all available outputs
Make sway-cycle-workspace executeable and place it in your PATH.
Put this to bind it to a hotkey in your sway config
bindsym $mod+q exec "sway-cycle-workspace"