Files
NixMachines/machines/universeair/yabai.nix

44 lines
1.3 KiB
Nix

{config, pkgs, lib, ...}: {
imports = [
# Custom Bar
# ./sketchybar.nix
# TODO: Customize Bar Later
];
environment.systemPackages = with pkgs; [
yabai
];
services.yabai = {
enable = true;
config = {
layout = "bsp";
focus_follows_mouse = "autofocus";
auto_balance = "on";
top_padding = 5;
bottom_padding = 5;
left_padding = 5;
right_padding = 5;
window_gap = 5;
};
extraConfig = ''
yabai -m rule --add app='System Settings' manage=off
yabai -m rule --add app='Boot Camp Assistant' manage=off
yabai -m rule --add app='System Information' manage=off
'';
};
# https://github.com/IvarWithoutBones/dotfiles/blob/main/modules/darwin/yabai/default.nix
# The scripting addition needs root access to load, which we want to do automatically when logging in.
# Disable the password requirement for it so that a service can do so without user interaction.
environment.etc."sudoers.d/yabai-load-sa".text = ''
universelaptop ALL = (root) NOPASSWD: sha256:${builtins.hashFile "sha256" "${pkgs.yabai}/bin/yabai"} ${pkgs.yabai}/bin/yabai
'';
launchd.user.agents.yabai-load-sa = {
path = [ pkgs.yabai config.environment.systemPath ];
command = "/usr/bin/sudo ${pkgs.yabai}/bin/yabai --load-sa";
serviceConfig.RunAtLoad = true;
};
}