Files
bankrupt/home-manager/modules/yabai.nix
T

55 lines
2.0 KiB
Nix
Raw Normal View History

2025-11-16 23:47:03 +08:00
# Yabai window manager configuration (macOS only)
2025-11-16 23:52:15 +08:00
# Note: Yabai is a system-level service and should be configured through nix-darwin
# This file only installs the package for home-manager
2025-11-16 23:47:03 +08:00
{
inputs,
lib,
config,
pkgs,
...
}: {
2025-11-16 23:52:15 +08:00
# Install yabai package for user
home.packages = lib.mkIf pkgs.stdenv.isDarwin [
pkgs.yabai
];
# Create yabai config file
home.file.".yabairc" = lib.mkIf pkgs.stdenv.isDarwin {
text = ''
#!/usr/bin/env sh
2025-11-16 23:47:03 +08:00
# layout
2025-11-16 23:52:15 +08:00
yabai -m config layout bsp
yabai -m config auto_balance off
yabai -m config split_ratio 0.50
yabai -m config window_placement second_child
2025-11-16 23:47:03 +08:00
# Gaps
2025-11-16 23:52:15 +08:00
yabai -m config window_gap 18
yabai -m config top_padding 18
yabai -m config bottom_padding 52
yabai -m config left_padding 18
yabai -m config right_padding 18
2025-11-16 23:47:03 +08:00
# shadows and borders
2025-11-16 23:52:15 +08:00
yabai -m config window_shadow float
2025-11-16 23:47:03 +08:00
# mouse
2025-11-16 23:52:15 +08:00
yabai -m config mouse_follows_focus off
yabai -m config focus_follows_mouse off
yabai -m config mouse_modifier cmd
yabai -m config mouse_action1 move
yabai -m config mouse_action2 resize
yabai -m config mouse_drop_action swap
2025-11-16 23:47:03 +08:00
# rules
yabai -m rule --add app="^(Genshin Impact|LuLu|Vimac|Calculator|Software Update|Dictionary|VLC|System Preferences|zoom.us|Photo Booth|Archive Utility|Python|LibreOffice|App Store|Steam|Alfred|Activity Monitor)$" manage=off
yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off
yabai -m rule --add label="Safari" app="^Safari$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Advance)$" manage=off
yabai -m rule --add label="About This Mac" app="System Information" title="About This Mac" manage=off
yabai -m rule --add label="Select file to save to" app="^Inkscape$" title="Select file to save to" manage=off
'';
2025-11-16 23:52:15 +08:00
executable = true;
2025-11-16 23:47:03 +08:00
};
}