Switching from yabai to aerospace; moved module nix files to directory

This commit is contained in:
Random936 2024-11-01 21:53:46 -07:00
parent 830e426bd1
commit e8b184b4ae
9 changed files with 112 additions and 108 deletions

View File

@ -12,6 +12,9 @@
homebrew = {
enable = true;
onActivation.cleanup = "zap";
taps = [
"nikitabobko/tap"
];
brews = [
"wireguard-tools"
"bitwarden-cli"
@ -22,6 +25,7 @@
"scroll-reverser"
"google-chrome"
"instantview"
"aerospace"
"bitwarden"
"tailscale"
"discord"
@ -59,94 +63,5 @@
home = "/Users/jadenmaxwell";
};
# Window Manager
services.skhd = {
enable = true;
skhdConfig = ''
# Config intended for use with Yabai on MacOS
# Switching Window Focus
cmd - h : yabai -m window --focus west
cmd - j : yabai -m window --focus south
cmd - k : yabai -m window --focus north
cmd - l : yabai -m window --focus east
# Swap Windows
shift + cmd - h : yabai -m window --swap west
shift + cmd - j : yabai -m window --swap south
shift + cmd - k : yabai -m window --swap north
shift + cmd - l : yabai -m window --swap east
# Focus on Space #
cmd - 1 : yabai -m space --focus 1
cmd - 2 : yabai -m space --focus 2
cmd - 3 : yabai -m space --focus 3
cmd - 4 : yabai -m space --focus 4
cmd - 5 : yabai -m space --focus 5
cmd - 6 : yabai -m space --focus 6
cmd - 7 : yabai -m space --focus 7
cmd - 8 : yabai -m space --focus 8
cmd - 9 : yabai -m space --focus 9
# Move Window to Space #
shift + cmd - 1 : yabai -m window --space 1
shift + cmd - 2 : yabai -m window --space 2
shift + cmd - 3 : yabai -m window --space 3
shift + cmd - 4 : yabai -m window --space 4
shift + cmd - 5 : yabai -m window --space 5
shift + cmd - 6 : yabai -m window --space 6
shift + cmd - 7 : yabai -m window --space 7
shift + cmd - 8 : yabai -m window --space 8
shift + cmd - 9 : yabai -m window --space 9
# Toggle window split
cmd - e : yabai -m window --toggle split
# Full Screen Window
cmd - f : yabai -m window --toggle zoom-fullscreen
alt - f : osascript -e 'tell application "System Events" to set frontApp to name of first application process whose frontmost is true' \
-e 'tell application "System Events" to tell process frontApp to click menu item "Find" of menu 1 of menu item "Find" of menu "Edit" of menu bar item "Edit" of menu bar 1'
# Close window with i3 keybinding
cmd - q : yabai -m window --close
# Close space
shift + cmd - w : yabai -m space --destroy
# Application shortcuts
shift + cmd - e : emacs
shift + cmd - f : open -n -a "Google Chrome"
shift + cmd - d : open -n -a "Discord"
cmd - return : osascript -e 'tell application "iTerm2" to create window with default profile'
# Reload skhd config
shift + cmd - r : ${pkgs.skhd}/bin/skhd -r
'';
};
services.yabai = {
enable = true;
enableScriptingAddition = true;
config = {
layout = "bsp";
mouse_follows_focus = "on";
focus_follows_mouse = "autoraise";
window_placement = "second_child";
auto_balance = "on";
mouse_modifier = "fn";
mouse_action1 = "move";
mouse_action2 = "resize";
};
extraConfig = ''
yabai -m signal --add event=window_destroyed action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse"
yabai -m signal --add event=application_terminated action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse"
yabai -m rule --add app="^System Settings$" manage=off
yabai -m rule --add app="^Calculator$" manage=off
yabai -m rule --add app="^iPhone Mirroring$" manage=off
'';
};
system.stateVersion = 4;
}

View File

@ -10,8 +10,9 @@
imports = [
./shared.nix
./neovim.nix
./emacs.nix
./zsh.nix
./modules/aerospace.nix
./modules/neovim.nix
./modules/emacs.nix
./modules/zsh.nix
];
}

View File

@ -7,10 +7,10 @@
imports = [
./shared.nix
./hacking.nix
./neovim.nix
./emacs.nix
./zsh.nix
./modules/hacking.nix
./modules/neovim.nix
./modules/emacs.nix
./modules/zsh.nix
];
home.packages = with pkgs; [

View File

@ -7,8 +7,8 @@
imports = [
./shared.nix
./neovim.nix
./zsh.nix
./modules/neovim.nix
./modules/zsh.nix
];
home.packages = with pkgs; [

View File

@ -0,0 +1,88 @@
{ ... }: {
home.file.".aerospace.toml".text = ''
# Reference: https://github.com/i3/i3/blob/next/etc/config
# i3 doesn't have "normalizations" feature that why we disable them here.
# But the feature is very helpful.
# Normalizations eliminate all sorts of weird tree configurations that don't make sense.
# Give normalizations a chance and enable them back.
enable-normalization-flatten-containers = false
enable-normalization-opposite-orientation-for-nested-containers = false
# Mouse follows focus when focused monitor changes
on-focused-monitor-changed = ['move-mouse monitor-lazy-center']
[mode.main.binding]
# See: https://nikitabobko.github.io/AeroSpace/goodness#open-a-new-window-with-applescript
alt-enter = '''exec-and-forget osascript -e '
tell application "Terminal"
do script
activate
end tell'
'''
# i3 wraps focus by default
alt-j = 'focus --boundaries-action wrap-around-the-workspace left'
alt-k = 'focus --boundaries-action wrap-around-the-workspace down'
alt-l = 'focus --boundaries-action wrap-around-the-workspace up'
alt-semicolon = 'focus --boundaries-action wrap-around-the-workspace right'
alt-shift-j = 'move left'
alt-shift-k = 'move down'
alt-shift-l = 'move up'
alt-shift-semicolon = 'move right'
# Consider using 'join-with' command as a 'split' replacement if you want to enable normalizations
alt-h = 'split horizontal'
alt-v = 'split vertical'
alt-f = 'fullscreen'
alt-s = 'layout v_accordion' # 'layout stacking' in i3
alt-w = 'layout h_accordion' # 'layout tabbed' in i3
alt-e = 'layout tiles horizontal vertical' # 'layout toggle split' in i3
alt-shift-space = 'layout floating tiling' # 'floating toggle' in i3
# Not supported, because this command is redundant in AeroSpace mental model.
# See: https://nikitabobko.github.io/AeroSpace/guide#floating-windows
#alt-space = 'focus toggle_tiling_floating'
# `focus parent`/`focus child` are not yet supported, and it's not clear whether they
# should be supported at all https://github.com/nikitabobko/AeroSpace/issues/5
# alt-a = 'focus parent'
alt-1 = 'workspace 1'
alt-2 = 'workspace 2'
alt-3 = 'workspace 3'
alt-4 = 'workspace 4'
alt-5 = 'workspace 5'
alt-6 = 'workspace 6'
alt-7 = 'workspace 7'
alt-8 = 'workspace 8'
alt-9 = 'workspace 9'
alt-0 = 'workspace 10'
alt-shift-1 = 'move-node-to-workspace 1'
alt-shift-2 = 'move-node-to-workspace 2'
alt-shift-3 = 'move-node-to-workspace 3'
alt-shift-4 = 'move-node-to-workspace 4'
alt-shift-5 = 'move-node-to-workspace 5'
alt-shift-6 = 'move-node-to-workspace 6'
alt-shift-7 = 'move-node-to-workspace 7'
alt-shift-8 = 'move-node-to-workspace 8'
alt-shift-9 = 'move-node-to-workspace 9'
alt-shift-0 = 'move-node-to-workspace 10'
alt-shift-c = 'reload-config'
alt-r = 'mode resize'
[mode.resize.binding]
h = 'resize width -50'
j = 'resize height +50'
k = 'resize height -50'
l = 'resize width +50'
enter = 'mode main'
esc = 'mode main'
'';
}

View File

@ -44,13 +44,13 @@
};
home.file = {
".emacs".source = ../dotfiles/.emacs;
".emacs.d/config.org".source = ../dotfiles/.emacs.d/config.org;
".emacs.d/terminal.org".source = ../dotfiles/.emacs.d/terminal.org;
".emacs.d/functions.org".source = ../dotfiles/.emacs.d/functions.org;
".emacs.d/email.org".source = ../dotfiles/.emacs.d/email.org;
".emacs.d/org.org".source = ../dotfiles/.emacs.d/org.org;
".emacs.d/lsp.org".source = ../dotfiles/.emacs.d/lsp.org;
".mbsyncrc".source = ../dotfiles/.mbsyncrc;
".emacs".source = ../../dotfiles/.emacs;
".emacs.d/config.org".source = ../../dotfiles/.emacs.d/config.org;
".emacs.d/terminal.org".source = ../../dotfiles/.emacs.d/terminal.org;
".emacs.d/functions.org".source = ../../dotfiles/.emacs.d/functions.org;
".emacs.d/email.org".source = ../../dotfiles/.emacs.d/email.org;
".emacs.d/org.org".source = ../../dotfiles/.emacs.d/org.org;
".emacs.d/lsp.org".source = ../../dotfiles/.emacs.d/lsp.org;
".mbsyncrc".source = ../../dotfiles/.mbsyncrc;
};
}

View File

@ -49,12 +49,12 @@
plugins = [
{
name = "custom-functions";
src = ../dotfiles;
src = ../../dotfiles;
file = ".functions.zsh";
}
{
name = "powerlevel10k-config";
src = ../dotfiles;
src = ../../dotfiles;
file = ".p10k.zsh";
}
];