Sets yabai to open new windows in focused space

This commit is contained in:
willemml 2023-11-16 10:26:28 -08:00
parent d132cf47b8
commit c27aaf2cd5
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
3 changed files with 14 additions and 8 deletions

View file

@ -11,6 +11,7 @@
editor "${config.programs.emacs.finalPackage.out}/bin/emacsclient" -nw -c editor "${config.programs.emacs.finalPackage.out}/bin/emacsclient" -nw -c
macos_option_as_alt yes macos_option_as_alt yes
confirm_os_window_close 0
''; '';
shellIntegration.enableZshIntegration = true; shellIntegration.enableZshIntegration = true;

View file

@ -29,6 +29,7 @@ in {
enableScriptingAddition = true; enableScriptingAddition = true;
config = { config = {
window_origin_display = "focused";
window_placement = "second_child"; window_placement = "second_child";
window_shadow = "on"; window_shadow = "on";
window_border = "off"; window_border = "off";
@ -70,7 +71,6 @@ in {
set +x set +x
echo "yabai configuration loaded.." echo "yabai configuration loaded.."
''; '';
}; };

View file

@ -3,7 +3,12 @@
pkgs, pkgs,
config, config,
... ...
}: { }: let
home = config.home-manager.users.willem;
homeDir = config.users.users.willem.home;
emacsCfg = home.programs.emacs;
kittyCfg = home.programs.kitty;
in {
services.yabai = { services.yabai = {
enableScriptingAddition = true; enableScriptingAddition = true;
extraConfig = '' extraConfig = ''
@ -14,7 +19,7 @@
environment.etc = { environment.etc = {
"sudoers.d/yabai".text = '' "sudoers.d/yabai".text = ''
willem ALL=(root) NOPASSWD: ${pkgs.yabai}/bin/yabai --load-sa %admin ALL=(root) NOPASSWD: ${pkgs.yabai}/bin/yabai --load-sa
''; '';
}; };
@ -29,10 +34,10 @@
}; };
services.skhd.skhdConfig = let services.skhd.skhdConfig = let
yabai = "${pkgs.yabai}/bin/yabai"; yabai = "${config.services.yabai.package}/bin/yabai";
# Don't use nix emacs. Homebrew has a better version # Don't use nix emacs. Homebrew has a better version
# emacs = "${pkgs.emacs}/bin/emacs"; # emacs = "${pkgs.emacs}/bin/emacs";
kitty = "${pkgs.kitty}/bin/kitty"; kitty = "${kittyCfg.package}/bin/kitty";
# Handle any weird inversion bindings # Handle any weird inversion bindings
cmd = "cmd"; cmd = "cmd";
ctrl = "ctrl"; ctrl = "ctrl";
@ -42,7 +47,7 @@
cmd - m : : cmd - m : :
rcmd - w : : rcmd - w : :
${ctrl} - return : ${kitty} --single-instance ${ctrl} - return : ${kitty} --single-instance --working-directory ${homeDir}
# Close window # Close window
${cmd} + shift - c : osascript -e 'tell application "System Events" to perform action "AXPress" of (first button whose subrole is "AXCloseButton") of (first window whose subrole is "AXStandardWindow") of (first process whose frontmost is true)' ${cmd} + shift - c : osascript -e 'tell application "System Events" to perform action "AXPress" of (first button whose subrole is "AXCloseButton") of (first window whose subrole is "AXStandardWindow") of (first process whose frontmost is true)'
@ -114,8 +119,8 @@
${yabai} -m window --toggle border ${yabai} -m window --toggle border
# Open Emacs # Open Emacs
${ctrl} + shift - n : ${kitty} --single-instance ${config.home-manager.users.willem.programs.emacs.finalPackage}/bin/emacsclient -nw -c ${ctrl} + shift - n : ${kitty} --single-instance ${emacsCfg.finalPackage}/bin/emacsclient -nw
# Open Firefox window # Open Firefox window
${ctrl} + shift - f : /Applications/Firefox.app/Contents/MacOS/firefox -new-window ${ctrl} + shift - b : /Applications/Firefox.app/Contents/MacOS/firefox -new-window
''; '';
} }