Files
bankrupt/home-manager/modules/yabai.nix
T
2025-11-16 23:52:15 +08:00

55 lines
2.0 KiB
Nix

# Yabai window manager configuration (macOS only)
# Note: Yabai is a system-level service and should be configured through nix-darwin
# This file only installs the package for home-manager
{
inputs,
lib,
config,
pkgs,
...
}: {
# 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
# layout
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
# Gaps
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
# shadows and borders
yabai -m config window_shadow float
# mouse
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
# 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
'';
executable = true;
};
}