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_tmp /dev/shm/screenshot_shm.png
set $screenshot_script ~/.configs_pointer/bin/screenshot_wayland.py set $screenshot_script ~/.configs_pointer/bin/screenshot_wayland.py
set $toggle_gaps ~/.configs_pointer/sway/toggle_gaps.py
#╔─────────────────────────────────────────────────────────────────────────────╗ #╔─────────────────────────────────────────────────────────────────────────────╗
#│ Pαηεs αηd cδηταiηεrs | #│ 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+bracketleft gaps inner current plus 3
#bindsym $mod2+equal gaps toggle #bindsym $mod2+equal gaps toggle
# Standard outer gapping for 27" screen # Standard outer gapping for 27" screen
bindsym $mod2+c gaps vertical current set 100, \ bindsym $mod2+c exec $toggle_gaps toggle 100 200
gaps horizontal current set 200
# Same as above, shifted left slightly # Same as above, shifted left slightly
bindsym $mod2+g gaps vertical current set 100, \ bindsym $mod2+g gaps vertical current set 100, \
gaps left current set 150, \ gaps left current set 150, \
@ -288,7 +289,7 @@ floating_modifier $mod1 normal
# Screenlock # Screenlock
bindsym $mod2+i exec ~/.config/sway/brightness_lock.sh bindsym $mod2+i exec ~/.config/sway/brightness_lock.sh
# Screen kill (turns off display output, but keeps virtual display active) # 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 # Scratchpad
bindsym $mod1+Shift+minus move scratchpad bindsym $mod1+Shift+minus move scratchpad
bindsym $mod1+minus scratchpad show bindsym $mod1+minus scratchpad show

View file

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