Yabai: Support for padding increase/decrease commands?

Created on 23 Jun 2019  路  3Comments  路  Source: koekeishiya/yabai

I've recently got into chunkwm, and I'm now migrating my configurations to yabai as I found out about the deprecation of chunkwm, so far so good.

My only gripe is the lack of a way to quickly increase/decrease the padding of the current desktop, like the old chunkc tiling::desktop --padding inc/dec used to do, is that something that is planned to be brought back or not?

In the meantime, and for anyone else who might be looking to get that feature back, I managed to "hack" it 馃槄

# in .yabairc
echo <your-padding-value> > /tmp/yabai_padding

# in .skhdrc
# Increase padding (-)
ctrl + alt + cmd - 0x1B : gap=$(cat /tmp/yabai_top_padding); yabai -m space --padding $((gap + 10)):$((gap + 10)):$((gap + 10)):$((gap + 10)); echo $((gap + 10)) > /tmp/yabai_top_padding

# Decrease padding (+)
ctrl + alt + cmd - 0x18 : gap=$(cat /tmp/yabai_top_padding); yabai -m space --padding $((gap - 10)):$((gap - 10)):$((gap - 10)):$((gap - 10)); echo $((gap - 10)) > /tmp/yabai_top_padding

It's pretty ugly but it works 馃榿

Most helpful comment

Fixed on master.

My previous comment was not a suitable way to implement this, because in a multi-display setup, some displays naturally have negative coordinates, and thus there is no way to know if -200 is supposed to be relative to the current position, or an absolute position on a secondary display.

Because of this, there is a type specifier required as the first argument. E.g:

# increase padding in all directions by 30
yabai -m space --padding rel:30:30:30:30

# reset padding back to 20 for all sides
yabai -m space --padding abs:20:20:20:20

# increase gap by 5
yabai -m space --gap rel:5

# reset gap to 10
yabai -m space --gap abs:10

# offset a windows position to the left by 20
yabai -m window --move rel:-20:0

# set the position of a window
yabai -m window --move abs:720:450

# set the size of a window
yabai -m window --resize abs:1024:768

All 3 comments

Might tweak the command to take optional relative sizes, e.g: yabai -m space --padding +20:-10:+20:-10. If no prefix is given, it will treat the value as absolute.

Fixed on master.

My previous comment was not a suitable way to implement this, because in a multi-display setup, some displays naturally have negative coordinates, and thus there is no way to know if -200 is supposed to be relative to the current position, or an absolute position on a secondary display.

Because of this, there is a type specifier required as the first argument. E.g:

# increase padding in all directions by 30
yabai -m space --padding rel:30:30:30:30

# reset padding back to 20 for all sides
yabai -m space --padding abs:20:20:20:20

# increase gap by 5
yabai -m space --gap rel:5

# reset gap to 10
yabai -m space --gap abs:10

# offset a windows position to the left by 20
yabai -m window --move rel:-20:0

# set the position of a window
yabai -m window --move abs:720:450

# set the size of a window
yabai -m window --resize abs:1024:768

Amazing! thanks :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

koekeishiya picture koekeishiya  路  4Comments

brorbw picture brorbw  路  4Comments

ThiagoFacchini picture ThiagoFacchini  路  4Comments

koekeishiya picture koekeishiya  路  4Comments

d-miketa picture d-miketa  路  3Comments