configure yabai and skhd to work together on darwin

This commit is contained in:
Haak Saxberg 2023-05-17 23:47:50 -07:00
parent 9e22c7fe74
commit 1f8c7f94bc

View file

@ -51,6 +51,94 @@
'' ''
); );
services.yabai = {
enable = true;
package = pkgs.yabai;
config = {
# layout
layout = "bsp";
auto_balance = "off";
split_ratio = "0.50";
window_placement = "second_child";
# Gaps
window_gap = 5;
top_padding = 5;
bottom_padding = 5;
left_padding = 5;
right_padding = 5;
# appearance, shadows, and borders
window_shadow = "float";
active_window_opacity = "1.0";
normal_window_opacity = "0.90";
active_window_border_color = "0xE0808080";
normal_window_border_color = "0x00010101";
window_border = "on";
window_border_width = "2";
# mouse
mouse_follows_focus = "off";
focus_follows_mouse = "off";
mouse_modifier = "fn";
mouse_action1 = "move";
mouse_action2 = "resize";
mouse_drop_action = "swap";
};
extraConfig = ''
# Unload the macOS WindowManager process
launchctl unload -F /System/Library/LaunchAgents/com.apple.WindowManager.plist > /dev/null 2>&1 &
# Don't bother tiling certain low-info app windows
yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off
yabai -m rule --add label="System Preferences" app="^System Preferences$" title=".*" manage=off
yabai -m rule --add label="System Settings" app="^System Settings$" title=".*" manage=off
yabai -m rule --add label="App Store" app="^App Store$" manage=off
yabai -m rule --add label="Activity Monitor" app="^Activity Monitor$" manage=off
yabai -m rule --add label="Software Update" title="Software Update" manage=off
yabai -m rule --add label="About This Mac" app="System Information" title="About This Mac" manage=off
'';
};
services.skhd = {
enable = true;
package = pkgs.skhd;
skhdConfig = ''
# Float / Unfloat window
lalt - space : yabai -m window --toggle float
# Make window zoom to fullscreen
shift + lalt - f : yabai -m window --toggle zoom-fullscreen
# Window Navigation (through display borders)
lalt - h : yabai -m window --focus west || yabai -m display --focus west
lalt - j : yabai -m window --focus south || yabai -m display --focus south
lalt - k : yabai -m window --focus north || yabai -m display --focus north
lalt - l : yabai -m window --focus east || yabai -m display --focus east
# Moving windows between spaces: (Assumes 3 Spaces Max per Display)
shift + lalt - 1 : DISPLAY="$(yabai -m query --displays --display | jq '.index')";\
yabai -m window --space $((1+4*($DISPLAY - 1)))
shift + lalt - 2 : DISPLAY="$(yabai -m query --displays --display | jq '.index')";\
yabai -m window --space $((2+4*($DISPLAY - 1)))
shift + lalt - 3 : DISPLAY="$(yabai -m query --displays --display | jq '.index')";\
yabai -m window --space $((3+4*($DISPLAY - 1)))
## Stacks
# Add the active window to the window or stack to the {direction}
shift + ctrl - h : yabai -m window west --stack $(yabai -m query --windows --window | jq -r '.id')
shift + ctrl - j : yabai -m window south --stack $(yabai -m query --windows --window | jq -r '.id')
shift + ctrl - k : yabai -m window north --stack $(yabai -m query --windows --window | jq -r '.id')
shift + ctrl - l : yabai -m window east --stack $(yabai -m query --windows --window | jq -r '.id')
# Stack Navigation: shift + ctrl - {n, p}
shift + ctrl - n : yabai -m window --focus stack.next
shift + ctrl - p : yabai -m window --focus stack.prev
## Misc
# Equalize size of windows
ctrl + lalt - e : yabai -m space --balance
'';
};
launchd.user.agents.syncthing = { launchd.user.agents.syncthing = {
path = [ pkgs.syncthing ]; path = [ pkgs.syncthing ];
command = "syncthing serve"; command = "syncthing serve";