ENRHXIAOXEVZGED76KL4CZJ5SPZDX5IRS3WICJ22WRKSCCU6IC2QC
KJ423ITE6PMMXBXVIW6CMUB435OQKM3ECO2TEXFA555HRSZCVHOAC
G3HOZ76K2NR5UVTKVUI6ZDOXQWCU3CAMTK2OOHKKMRV73GQ7CFSAC
DCJDPW7CQ5OR75ECIVESHYVC5JSXZ5CKV6E3EWLRFHHKAKE7JGKAC
BX2EXA45RHKBK4ZFZYUMHYDYKRVIUQJZDW6O643XUHKI5LVNDSJAC
4A5J4ZQ3HM2ZK6OO7N3RZ2WX3YHNGA3X5WJIB4UQJPQGUG4O3AYQC
QADXBPZPPIAICY2HTCAZSZYX33TG72CXI2XZOG3DCNMOIXAPWQMQC
MAIEPZVQNNMHNN5MJ4UVPR5D7M3EE4B6QEBTR7L3KQERPUKOD5IQC
TEJLAHEG6JYVPWBHUHIO6NTSB7HO62RJ6G5J2B6UNPDVG7XK4XIAC
QRSG7RJSX5R255Y2HHTLYBXMBR374QS3PV2UJDWK2ZPMG7V66SSAC
47GPXWYAN5HMMVVIWFEAY63MID4U2UHIBH4HNMDYWNQ2J6E2WX6AC
VXESMJDKIRYTNWV6PVDZUSECSP7ESMK5LZPEE72DFBUU5MH7GWLAC
A32NGEIBDOOKELILD6YPAGDCEDVVSYBSNJNS4RDXB7SHBQNIVNPQC
BYCLZBRJTN2ZIINK42SBGJHKCPVXECL632SYTV6EEQROEUNZJFHAC
NC3PZB4VVLIWOHU2OONGNZT3LYZO7ZRZMBMFCBYU2464VG3VLX4QC
#########################################
# yabai is a macos tiling window manager
# https://github.com/koekeishiya/yabai
#########################################
{ config, pkgs, ...}:
let
utils = (import ../utils pkgs);
yabaiifyRules = utils.stringify {
mkKey = k: "yabai -m rule --add app='^${k}$'";
mkValue = v: "manage=${if v then "on" else "off"}";
};
unmanaged_apps = {
# apps are usually managed by default
"System Information" = false;
"System Preferences" = false;
"Karabiner-Elements" = false;
"Disk Utility" = false;
"Flux" = false;
"Messages" = false;
"sure-zooms" = false;
};
in {
config.services.yabai = {
enable = true;
package = pkgs.yabai;
config = {
window_placement = "second_child";
window_topmost = "on";
window_shadow = "float";
window_border = "off";
window_opacity = "off";
insert_feedback_color = "0xffd75f5f";
split_ratio = "0.50";
auto_balance = "on";
mouse_drop_action = "swap";
layout = "bsp";
top_padding = 6;
bottom_padding = 6;
left_padding = 6;
right_padding = 6;
window_gap = 6;
};
extraConfig = ''
${yabaiifyRules unmanaged_apps}
# float iterm window that emulate guake (floats from bottom)
yabai -m rule --add app='^iTerm2$' title="^Hotkey Window$" manage=off
echo "$(date "+%Y-%m-%d %H:%M:%s") - yabai configuration loaded..."
'';
};
}
{ config, pkgs, ...}:
{
config.services.skhd = {
enable = true;
# package = pkgs.skhd;
skhdConfig = ''
#############################################################
# Generated by darwin-rebuild from nixpkgs.darwin.skhdrc in
# ~/dotfiles
# For skhd info see: https://github.com/koekeishiya/skhd
#############################################################
# -- restart yabai --
cmd + alt + ctrl - y : launchctl kickstart -k "gui/''${UID}/org.nixos.yabai"
# -- restart skhd --
cmd + alt + ctrl - s : skhd -r
###################
# WINDOW MANAGEMENT
###################
# -- focusing within the current "space" --
hyper - h : yabai -m window --focus west
hyper - j : yabai -m window --focus south
hyper - k : yabai -m window --focus north
hyper - l : yabai -m window --focus east
# -- rearraging within the current "space" --
cmd + alt - h : yabai -m window --warp west
cmd + alt - j : yabai -m window --warp south
cmd + alt - k : yabai -m window --warp north
cmd + alt - l : yabai -m window --warp east
cmd + alt - u : yabai -m window --swap west
cmd + alt - i : yabai -m window --swap south
cmd + alt - o : yabai -m window --swap north
cmd + alt - p : yabai -m window --swap east
cmd + alt - r : yabai -m space --mirror y-axis
cmd + alt + shift - r : yabai -m space --rotate 90
# -- change split type of focused window --
cmd + alt - e : yabai -m window --toggle split
# -- resizing --
cmd + alt - 0 : yabai -m space --balance
cmd + alt - f : yabai -m window --toggle zoom-fullscreen
cmd + alt + shift - f : yabai -m window --toggle zoom-parent
hyper - 0x18 : yabai -m window --toggle zoom-parent
# uses brackets left: [ right: ]
cmd + alt - 0x21 : yabai -m window --resize left:-20:0
cmd + alt + shift - 0x21 : yabai -m window --resize left:20:0
cmd + alt - 0x1E : yabai -m window --resize right:20:0
cmd + alt + shift - 0x1E : yabai -m window --resize right:-20:0
# uses + and -
cmd + alt - 0x1B : yabai -m window --resize top:0:20
cmd + alt +shift - 0x1B : yabai -m window --resize top:0:-20
cmd + alt - 0x18 : yabai -m window --resize bottom:0:20
cmd + alt + shift - 0x18 : yabai -m window --resize bottom:0:-20
# -- floating windows --
cmd + alt + ctrl - f : yabai -m window --toggle float; \
yabai -m window --grid 4:4:1:1:2:2
# floating window to left half & right half
cmd + alt - left : yabai -m window --grid 1:2:0:0:1:1
cmd + alt - right : yabai -m window --grid 1:2:1:0:1:1
# -- moving to another "space" on the current display --
cmd + alt - 1 : wid=$($DOTFILES/zsh/functions/yabai_window_id.zsh) yabai -m window --space 1; yabai -m window --focus $wid
cmd + alt - 2 : wid=$($DOTFILES/zsh/functions/yabai_window_id.zsh) yabai -m window --space 2; yabai -m window --focus $wid
cmd + alt - 3 : wid=$($DOTFILES/zsh/functions/yabai_window_id.zsh) yabai -m window --space 3; yabai -m window --focus $wid
cmd + alt - 4 : wid=$($DOTFILES/zsh/functions/yabai_window_id.zsh) yabai -m window --space 4; yabai -m window --focus $wid
cmd + alt - 5 : wid=$($DOTFILES/zsh/functions/yabai_window_id.zsh) yabai -m window --space 5; yabai -m window --focus $wid
cmd + alt - 6 : wid=$($DOTFILES/zsh/functions/yabai_window_id.zsh) yabai -m window --space 6; yabai -m window --focus $wid
cmd + alt - 7 : wid=$($DOTFILES/zsh/functions/yabai_window_id.zsh) yabai -m window --space 7; yabai -m window --focus $wid
cmd + alt - 8 : wid=$($DOTFILES/zsh/functions/yabai_window_id.zsh) yabai -m window --space 8; yabai -m window --focus $wid
# -- moving to another to another display --
cmd + ctrl - 1 : yabai -m window --display 1; yabai -m display --focus 1
cmd + ctrl - 2 : yabai -m window --display 2; yabai -m display --focus 2
cmd + ctrl - 3 : yabai -m window --display 3; yabai -m display --focus 3
# -- focus another display --
hyper - 1 : yabai -m display --focus 1
hyper - 2 : yabai -m display --focus 2
hyper - 3 : yabai -m display --focus 3
hyper - b : yabai -m display --focus prev || yabai -m display --focus recent
hyper - n : yabai -m display --focus next || yabai -m display --focus recent
# -- stack windows onto each other
shift + cmd - b : yabai -m window --focus stack.prev || yabai -m window --focus stack.last
shift + cmd - n : yabai -m window --focus stack.next || yabai -m window --focus stack.first
shift + cmd - h : yabai -m window --stack west
shift + cmd - j : yabai -m window --stack south
shift + cmd - k : yabai -m window --stack north
shift + cmd - l : yabai -m window --stack east
'';
};
}
{ config, pkgs, ... }:
{
system.defaults.NSGlobalDomain.AppleKeyboardUIMode = 3;
system.defaults.NSGlobalDomain.NSAutomaticCapitalizationEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticDashSubstitutionEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticPeriodSubstitutionEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticQuoteSubstitutionEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticSpellingCorrectionEnabled = false;
system.defaults.NSGlobalDomain.NSNavPanelExpandedStateForSaveMode = true;
system.defaults.NSGlobalDomain.NSNavPanelExpandedStateForSaveMode2 = true;
system.defaults.NSGlobalDomain._HIHideMenuBar = true;
system.defaults.finder.AppleShowAllExtensions = true;
system.defaults.finder.FXEnableExtensionChangeWarning = false;
system.defaults.dock.autohide = true;
system.defaults.dock.mru-spaces = false;
system.defaults.dock.orientation = "left";
system.defaults.dock.showhidden = true;
system.defaults.trackpad.Clicking = true;
system.defaults.trackpad.TrackpadThreeFingerDrag = true;
system.keyboard.enableKeyMapping = false;
}
# TODO FIXME these are not working right now
# temporarily installing w/ homebrew
# services.yabai.enable = true;
# services.yabai.package = pkgs.yabai;
# services.skhd.enable = true;
# services.skhd.package = pkgs.skhd;
# services.emacs.enable = true;
# TODO FIXME not sure how to pass the doom-emacs package to this variable
# services.emacs.package = config.home-manager.users.christophercummings.services.emacs.package;
system.defaults.NSGlobalDomain.AppleKeyboardUIMode = 3;
system.defaults.NSGlobalDomain.NSAutomaticCapitalizationEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticDashSubstitutionEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticPeriodSubstitutionEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticQuoteSubstitutionEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticSpellingCorrectionEnabled = false;
system.defaults.NSGlobalDomain.NSNavPanelExpandedStateForSaveMode = true;
system.defaults.NSGlobalDomain.NSNavPanelExpandedStateForSaveMode2 = true;
system.defaults.NSGlobalDomain._HIHideMenuBar = true;
system.defaults.finder.AppleShowAllExtensions = true;
system.defaults.finder.FXEnableExtensionChangeWarning = false;
system.defaults.dock.autohide = true;
system.defaults.dock.mru-spaces = false;
system.defaults.dock.orientation = "left";
system.defaults.dock.showhidden = true;
system.defaults.trackpad.Clicking = true;
system.defaults.trackpad.TrackpadThreeFingerDrag = true;
system.keyboard.enableKeyMapping = false;