Sway: improve gap toggling

This commit is contained in:
Akemi Izuko 2024-05-02 16:14:28 -06:00
parent 71a0fb7f14
commit e11cef88d2
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC
2 changed files with 21 additions and 15 deletions

View file

@ -55,6 +55,8 @@ set $screenshot_sound ffplay -nodisp -autoexit -v error ~/.config/sway/screensho
set $screenshot_tmp /dev/shm/screenshot_shm.png
set $screenshot_script ~/.configs_pointer/bin/screenshot_wayland.py
set $toggle_gaps ~/.configs_pointer/sway/toggle_gaps.py
#╔─────────────────────────────────────────────────────────────────────────────╗
#│ Pαηεs αηd cδηταiηεrs |
#╚─────────────────────────────────────────────────────────────────────────────╝
@ -136,8 +138,7 @@ bindsym $mod2+bracketright gaps inner current minus 3
bindsym $mod2+bracketleft gaps inner current plus 3
#bindsym $mod2+equal gaps toggle
# Standard outer gapping for 27" screen
bindsym $mod2+c gaps vertical current set 100, \
gaps horizontal current set 200
bindsym $mod2+c exec $toggle_gaps toggle 100 200
# Same as above, shifted left slightly
bindsym $mod2+g gaps vertical current set 100, \
gaps left current set 150, \
@ -288,7 +289,7 @@ floating_modifier $mod1 normal
# Screenlock
bindsym $mod2+i exec ~/.config/sway/brightness_lock.sh
# Screen kill (turns off display output, but keeps virtual display active)
bindsym --locked $mod2+u output * power toggle
bindsym --locked $mod2+u output DP-1 power toggle
# Scratchpad
bindsym $mod1+Shift+minus move scratchpad
bindsym $mod1+minus scratchpad show

View file

@ -33,19 +33,24 @@ def has_gaps(workspace):
def swaymsg_gaps(v, h, is_all):
for x, n in [[v, "vertical"], [h, "horizontal"]]:
swaymsg = subprocess.Popen(
[
"swaymsg",
"gaps",
n,
"all" if is_all else "current",
"set",
str(x),
]
)
swaymsg = subprocess.Popen(
[
"swaymsg",
"gaps",
"vertical",
"all" if is_all else "current",
"set",
str(v),
",",
"gaps",
"horizontal",
"all" if is_all else "current",
"set",
str(h)
]
)
swaymsg.communicate(1)
swaymsg.communicate(1)
def toggle_workspace(ws, v, h):