sway: Mejorar implementación
This commit is contained in:
parent
d1e6f15abb
commit
5cfd986282
3 changed files with 27 additions and 14 deletions
|
@ -119,15 +119,11 @@ 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)"
|
||||
bindsym Mod4+Prior exec sway-switch_workspace prev
|
||||
bindsym Mod4+Next exec sway-switch_workspace next
|
||||
bindsym Mod4+Mod1+Prior exec sway-switch_workspace prev move
|
||||
bindsym Mod4+Mod1+Next exec sway-switch_workspace next move
|
||||
|
||||
# Layout stuff:
|
||||
bindsym $mod+a focus parent
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#!/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
|
23
.local/bin/sway-switch_workspace
Executable file
23
.local/bin/sway-switch_workspace
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/luajit
|
||||
|
||||
local direction = arg[1]
|
||||
local move = arg[2]
|
||||
|
||||
--local file = io.popen "swaymsg -t get_outputs -r | jq -r '.[] | select(.focused == true) | .name'"
|
||||
local file = io.popen "swaymsg -t get_workspaces -r | jq -r '.[] | select(.focused == true) | .name'"
|
||||
local string = file:read '*a'
|
||||
print(string)
|
||||
|
||||
local command = 'workspace'
|
||||
if move == 'move' then
|
||||
command = 'move container to workspace'
|
||||
end
|
||||
|
||||
if direction == 'next' then
|
||||
os.execute('swaymsg '..command..' '..string+1)
|
||||
elseif direction == 'prev' then
|
||||
if string+0 ~= 1 then
|
||||
os.execute('swaymsg '..command..' '..string-1)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in a new issue