This commit is contained in:
2025-11-16 23:52:15 +08:00
parent b3f72c85ba
commit 646b68b960
6 changed files with 56 additions and 127 deletions
+33 -41
View File
@@ -1,4 +1,6 @@
# 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,
@@ -6,51 +8,40 @@
pkgs,
...
}: {
# Only enable on macOS since yabai is macOS-specific
services.yabai = lib.mkIf pkgs.stdenv.isDarwin {
enable = true;
# enableScriptingAddition = true;
package = pkgs.yabai;
config = {
# 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
layout = "bsp";
auto_balance = "off";
split_ratio = "0.50";
window_placement = "second_child";
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
window_gap = 18;
top_padding = 18;
bottom_padding = 52;
left_padding = 18;
right_padding = 18;
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
window_shadow = "float";
yabai -m config window_shadow float
# mouse
mouse_follows_focus = "off";
focus_follows_mouse = "off";
mouse_modifier = "cmd";
mouse_action1 = "move";
mouse_action2 = "resize";
mouse_drop_action = "swap";
};
# # Unload the macOS WindowManager process
# launchctl unload -F /System/Library/LaunchAgents/com.apple.WindowManager.plist > /dev/null 2>&1 &
# # bar
# yabai -m signal --add event=window_focused action="sketchybar --trigger window_focus"
# yabai -m signal --add event=display_added action="sleep 1 && ${scripts}/create_spaces.sh"
# yabai -m signal --add event=display_removed action="sleep 1 && ${scripts}/create_spaces.sh"
# yabai -m signal --add event=window_created action="sketchybar --trigger windows_on_spaces"
# yabai -m signal --add event=window_destroyed action="sketchybar --trigger windows_on_spaces"
# ${scripts}/create_spaces.sh
extraConfig = ''
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
@@ -58,5 +49,6 @@
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;
};
}