sway: Operar workspaces similar a GNOME
This commit is contained in:
parent
0628032c31
commit
d1e6f15abb
2 changed files with 15 additions and 0 deletions
|
@ -119,6 +119,15 @@ input * {
|
|||
# bindsym $mod+Shift+8 move container to workspace "8: comms"
|
||||
# bindsym $mod+Shift+9 move container to workspace "9: media"
|
||||
# bindsym $mod+Shift+0 move container to workspace number 10
|
||||
#
|
||||
# https://old.reddit.com/r/swaywm/comments/pe5ipl/workspace_next_or_new/
|
||||
set $next_or_new swaymsg -r -t get_workspaces | jq -r --arg OUTPUT $(swaymsg -t get_outputs -r | jq -r '.[] | select(.focused == true) | .name') '(. | (max_by(.num) | .num)) as $max | [.[] | select(.output == $OUTPUT)] | (max_by(.num) | .num) as $maxOutput | (.[] | select(.focused == true) | .num) as $current | if $maxOutput > $current then "next_on_output" else $max + 1 end'
|
||||
set $prev_or_new swaymsg -r -t get_workspaces | jq -r --arg OUTPUT $(swaymsg -t get_outputs -r | jq -r '.[] | select(.focused == true) | .name') '(. | (max_by(.num) | .num)) as $max | [.[] | select(.output == $OUTPUT)] | (min_by(.num) | .num) as $minOutput | (.[] | select(.focused == true) | .num) as $current | if $minOutput < $current then "prev_on_output" else $current end'
|
||||
|
||||
bindsym Mod4+Prior exec sway-compact_workspaces, exec swaymsg "workspace $($prev_or_new)"
|
||||
bindsym Mod4+Next exec sway-compact_workspaces, exec swaymsg "workspace $($next_or_new)"
|
||||
bindsym Mod4+Mod1+Prior exec sway-compact_workspaces, exec swaymsg "move container to workspace $($prev_or_new)"
|
||||
bindsym Mod4+Mod1+Next exec sway-compact_workspaces, exec swaymsg "move container to workspace $($next_or_new)"
|
||||
|
||||
# Layout stuff:
|
||||
bindsym $mod+a focus parent
|
||||
|
|
6
.local/bin/sway-compact_workspaces
Executable file
6
.local/bin/sway-compact_workspaces
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
count=1
|
||||
for workspace in $(swaymsg -t get_workspaces -r | jq '. | sort_by(.num)[] | .name'); do
|
||||
swaymsg rename workspace $workspace to $count
|
||||
((count+=1))
|
||||
done
|
Loading…
Reference in a new issue