nixos configs

Revert "darwin: switch from aerospace to PaperWM"

This reverts commit 3e2b3bf9d9cc822976e8f07db8a238e3dcc15c67.

+319 -131
-4
hosts/darwin.nix
··· 1 1 { 2 - imports = [ 3 - ../modules/system/focus-follows-mouse.nix 4 - ]; 5 - 6 2 system.defaults.NSGlobalDomain.AppleFontSmoothing = 0; # https://tonsky.me/blog/monitors/ 7 3 8 4 security.pam.services.sudo_local.touchIdAuth = true;
+200
modules/home/aerospace/aerospace.toml
··· 1 + # Place a copy of this config to ~/.aerospace.toml 2 + # After that, you can edit ~/.aerospace.toml to your liking 3 + 4 + # You can use it to add commands that run after login to macOS user session. 5 + # 'start-at-login' needs to be 'true' for 'after-login-command' to work 6 + # Available commands: https://nikitabobko.github.io/AeroSpace/commands 7 + after-login-command = [] 8 + 9 + # You can use it to add commands that run after AeroSpace startup. 10 + # 'after-startup-command' is run after 'after-login-command' 11 + # Available commands : https://nikitabobko.github.io/AeroSpace/commands 12 + after-startup-command = ['exec-and-forget sketchybar'] 13 + 14 + # Notify Sketchybar about workspace change 15 + exec-on-workspace-change = ['/bin/bash', '-c', 16 + 'sketchybar --trigger aerospace_workspace_change FOCUSED_WORKSPACE=$AEROSPACE_FOCUSED_WORKSPACE' 17 + ] 18 + 19 + # Start AeroSpace at login 20 + start-at-login = true 21 + 22 + # Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization 23 + enable-normalization-flatten-containers = true 24 + enable-normalization-opposite-orientation-for-nested-containers = true 25 + 26 + # See: https://nikitabobko.github.io/AeroSpace/guide#layouts 27 + # The 'accordion-padding' specifies the size of accordion padding 28 + # You can set 0 to disable the padding feature 29 + accordion-padding = 30 30 + 31 + # Possible values: tiles|accordion 32 + default-root-container-layout = 'tiles' 33 + 34 + # Possible values: horizontal|vertical|auto 35 + # 'auto' means: wide monitor (anything wider than high) gets horizontal orientation, 36 + # tall monitor (anything higher than wide) gets vertical orientation 37 + default-root-container-orientation = 'auto' 38 + 39 + # Mouse follows focus when focused monitor changes 40 + # Drop it from your config, if you don't like this behavior 41 + # See https://nikitabobko.github.io/AeroSpace/guide#on-focus-changed-callbacks 42 + # See https://nikitabobko.github.io/AeroSpace/commands#move-mouse 43 + # Fallback value (if you omit the key): on-focused-monitor-changed = [] 44 + on-focused-monitor-changed = ['move-mouse monitor-lazy-center'] 45 + 46 + # You can effectively turn off macOS "Hide application" (cmd-h) feature by toggling this flag 47 + # Useful if you don't use this macOS feature, but accidentally hit cmd-h or cmd-alt-h key 48 + # Also see: https://nikitabobko.github.io/AeroSpace/goodness#disable-hide-app 49 + automatically-unhide-macos-hidden-apps = true 50 + 51 + # Possible values: (qwerty|dvorak) 52 + # See https://nikitabobko.github.io/AeroSpace/guide#key-mapping 53 + [key-mapping] 54 + preset = 'qwerty' 55 + 56 + # Gaps between windows (inner-*) and between monitor edges (outer-*). 57 + # Possible values: 58 + # - Constant: gaps.outer.top = 8 59 + # - Per monitor: gaps.outer.top = [{ monitor.main = 16 }, { monitor."some-pattern" = 32 }, 24] 60 + # In this example, 24 is a default value when there is no match. 61 + # Monitor pattern is the same as for 'workspace-to-monitor-force-assignment'. 62 + # See: https://nikitabobko.github.io/AeroSpace/guide#assign-workspaces-to-monitors 63 + [gaps] 64 + inner.horizontal = 8 65 + inner.vertical = 8 66 + outer.left = 8 67 + outer.bottom = 8 68 + outer.top = 8 69 + outer.right = 8 70 + 71 + # 'main' binding mode declaration 72 + # See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes 73 + # 'main' binding mode must be always presented 74 + # Fallback value (if you omit the key): mode.main.binding = {} 75 + [mode.main.binding] 76 + 77 + # All possible keys: 78 + # - Letters. a, b, c, ..., z 79 + # - Numbers. 0, 1, 2, ..., 9 80 + # - Keypad numbers. keypad0, keypad1, keypad2, ..., keypad9 81 + # - F-keys. f1, f2, ..., f20 82 + # - Special keys. minus, equal, period, comma, slash, backslash, quote, semicolon, backtick, 83 + # leftSquareBracket, rightSquareBracket, space, enter, esc, backspace, tab 84 + # - Keypad special. keypadClear, keypadDecimalMark, keypadDivide, keypadEnter, keypadEqual, 85 + # keypadMinus, keypadMultiply, keypadPlus 86 + # - Arrows. left, down, up, right 87 + 88 + # All possible modifiers: cmd, alt, ctrl, shift 89 + 90 + # All possible commands: https://nikitabobko.github.io/AeroSpace/commands 91 + 92 + # See: https://nikitabobko.github.io/AeroSpace/commands#exec-and-forget 93 + # Open up remote terminal with alt + enter shortcut 94 + alt-enter = 'exec-and-forget wezterm connect arm.pc' 95 + 96 + # See: https://nikitabobko.github.io/AeroSpace/commands#layout 97 + alt-slash = 'layout tiles horizontal vertical' 98 + alt-comma = 'layout accordion horizontal vertical' 99 + 100 + # See: https://nikitabobko.github.io/AeroSpace/commands#focus 101 + alt-h = 'focus left' 102 + alt-j = 'focus down' 103 + alt-k = 'focus up' 104 + alt-l = 'focus right' 105 + 106 + # See: https://nikitabobko.github.io/AeroSpace/commands#move 107 + alt-shift-h = 'move left' 108 + alt-shift-j = 'move down' 109 + alt-shift-k = 'move up' 110 + alt-shift-l = 'move right' 111 + 112 + # See: https://nikitabobko.github.io/AeroSpace/commands#resize 113 + alt-shift-minus = 'resize smart -50' 114 + alt-shift-equal = 'resize smart +50' 115 + 116 + # See: https://nikitabobko.github.io/AeroSpace/commands#workspace 117 + alt-1 = 'workspace 1' 118 + alt-2 = 'workspace 2' 119 + #alt-3 = 'workspace 3' # conflicts with '#' key on GB keyboard 120 + alt-4 = 'workspace 4' 121 + alt-5 = 'workspace 5' 122 + alt-6 = 'workspace 6' 123 + alt-7 = 'workspace 7' 124 + alt-8 = 'workspace 8' 125 + alt-9 = 'workspace 9' 126 + 127 + # See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace 128 + alt-shift-1 = 'move-node-to-workspace 1' 129 + alt-shift-2 = 'move-node-to-workspace 2' 130 + #alt-shift-3 = 'move-node-to-workspace 3' 131 + alt-shift-4 = 'move-node-to-workspace 4' 132 + alt-shift-5 = 'move-node-to-workspace 5' 133 + alt-shift-6 = 'move-node-to-workspace 6' 134 + alt-shift-7 = 'move-node-to-workspace 7' 135 + alt-shift-8 = 'move-node-to-workspace 8' 136 + alt-shift-9 = 'move-node-to-workspace 9' 137 + 138 + # See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth 139 + alt-tab = 'workspace-back-and-forth' 140 + # See: https://nikitabobko.github.io/AeroSpace/commands#move-workspace-to-monitor 141 + alt-shift-tab = 'move-workspace-to-monitor --wrap-around next' 142 + 143 + # See: https://nikitabobko.github.io/AeroSpace/commands#mode 144 + alt-shift-semicolon = 'mode service' 145 + 146 + # 'service' binding mode declaration. 147 + # See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes 148 + [mode.service.binding] 149 + esc = ['reload-config', 'mode main'] 150 + r = ['flatten-workspace-tree', 'mode main'] # reset layout 151 + f = ['layout floating tiling', 'mode main'] # Toggle between floating and tiling layout 152 + backspace = ['close-all-windows-but-current', 'mode main'] 153 + 154 + # sticky is not yet supported https://github.com/nikitabobko/AeroSpace/issues/2 155 + #s = ['layout sticky tiling', 'mode main'] 156 + 157 + alt-shift-h = ['join-with left', 'mode main'] 158 + alt-shift-j = ['join-with down', 'mode main'] 159 + alt-shift-k = ['join-with up', 'mode main'] 160 + alt-shift-l = ['join-with right', 'mode main'] 161 + 162 + [[on-window-detected]] 163 + if.app-id = "com.kagi.kagimacOS" 164 + run = [ "move-node-to-workspace 1" ] 165 + 166 + [[on-window-detected]] 167 + if.app-id = "app.zen-browser.zen" 168 + run = [ "move-node-to-workspace 1" ] 169 + 170 + [[on-window-detected]] 171 + if.app-id = "com.tinyspeck.slackmacgap" 172 + run = [ "move-node-to-workspace 2" ] 173 + 174 + [[on-window-detected]] 175 + if.app-id = "dev.vencord.vesktop" 176 + run = [ "move-node-to-workspace 2" ] 177 + 178 + [[on-window-detected]] 179 + if.app-id = "com.microsoft.VSCode" 180 + run = [ "move-node-to-workspace 4" ] 181 + 182 + [[on-window-detected]] 183 + if.app-id = "md.obsidian" 184 + run = [ "move-node-to-workspace 7" ] 185 + 186 + [[on-window-detected]] 187 + if.app-id = "com.TickTick.task.mac" 188 + run = [ "move-node-to-workspace 8" ] 189 + 190 + [[on-window-detected]] 191 + if.app-id = "com.spotify.client" 192 + run = [ "move-node-to-workspace 9" ] 193 + 194 + [[on-window-detected]] 195 + if.app-id = "com.kagi.kagimacOS.WebApp.758E8559-F3A6-4B80-B34E-901673F85285" # SoundCloud 196 + run = [ "move-node-to-workspace 9" ] 197 + 198 + [[on-window-detected]] 199 + if.window-title-regex-substring = "Cisco Secure Client" 200 + run = [ "layout floating" ]
+29
modules/home/aerospace/default.nix
··· 1 + { 2 + config, 3 + lib, 4 + pkgs, 5 + ... 6 + }: 7 + { 8 + config = lib.mkIf config.isMacOS { 9 + home.packages = [ 10 + pkgs.aerospace 11 + #pkgs.sketchybar 12 + ]; 13 + home.file.".config/aerospace/aerospace.toml".source = ./aerospace.toml; 14 + launchd.agents.aerospace = { 15 + enable = true; 16 + config = { 17 + Program = "${pkgs.aerospace}/Applications/AeroSpace.app/Contents/MacOS/AeroSpace"; 18 + KeepAlive = true; 19 + RunAtLoad = true; 20 + StandardOutPath = "/tmp/aerospace.log"; 21 + StandardErrorPath = "/tmp/aerospace.err.log"; 22 + }; 23 + }; 24 + 25 + #home.file.".config/sketchybar/sketchybarrc" = { source = ./sketchybar/sketchybarrc; executable = true; }; 26 + #home.file.".config/sketchybar/plugins".source = ./sketchybar/plugins; 27 + #home.file.".config/sketchybar/plugins".recursive = true; 28 + }; 29 + }
+82
modules/home/aerospace/sketchybar/sketchybarrc
··· 1 + # This is a demo config to showcase some of the most important commands. 2 + # It is meant to be changed and configured, as it is intentionally kept sparse. 3 + # For a (much) more advanced configuration example see my dotfiles: 4 + # https://github.com/FelixKratz/dotfiles 5 + 6 + PLUGIN_DIR="$CONFIG_DIR/plugins" 7 + 8 + ##### Bar Appearance ##### 9 + # Configuring the general appearance of the bar. 10 + # These are only some of the options available. For all options see: 11 + # https://felixkratz.github.io/SketchyBar/config/bar 12 + # If you are looking for other colors, see the color picker: 13 + # https://felixkratz.github.io/SketchyBar/config/tricks#color-picker 14 + 15 + sketchybar --bar position=top height=38 blur_radius=30 color=0x40000000 16 + 17 + ##### Changing Defaults ##### 18 + # We now change some default values, which are applied to all further items. 19 + # For a full list of all available item properties see: 20 + # https://felixkratz.github.io/SketchyBar/config/items 21 + 22 + default=( 23 + padding_left=5 24 + padding_right=5 25 + icon.font="Hack Nerd Font:Bold:17.0" 26 + label.font="Hack Nerd Font:Bold:14.0" 27 + icon.color=0xffffffff 28 + label.color=0xffffffff 29 + icon.padding_left=4 30 + icon.padding_right=4 31 + label.padding_left=4 32 + label.padding_right=4 33 + ) 34 + sketchybar --default "${default[@]}" 35 + 36 + ##### Aerospace Workspaces ##### 37 + sketchybar --add event aerospace_workspace_change 38 + 39 + for sid in $(aerospace list-workspaces --all); do 40 + sketchybar --add item space.$sid left \ 41 + --subscribe space.$sid aerospace_workspace_change \ 42 + --set space.$sid \ 43 + background.color=0x44ffffff \ 44 + background.corner_radius=5 \ 45 + background.height=20 \ 46 + background.drawing=off \ 47 + label="$sid" \ 48 + click_script="aerospace workspace $sid" 49 + done 50 + 51 + ##### Adding Left Items ##### 52 + # We add some regular items to the left side of the bar, where 53 + # only the properties deviating from the current defaults need to be set 54 + 55 + # sketchybar --add item chevron left \ 56 + # --set chevron icon= label.drawing=off \ 57 + # --add item front_app left \ 58 + # --set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \ 59 + # --subscribe front_app front_app_switched 60 + 61 + ##### Adding Right Items ##### 62 + # In the same way as the left items we can add items to the right side. 63 + # Additional position (e.g. center) are available, see: 64 + # https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar 65 + 66 + # Some items refresh on a fixed cycle, e.g. the clock runs its script once 67 + # every 10s. Other items respond to events they subscribe to, e.g. the 68 + # volume.sh script is only executed once an actual change in system audio 69 + # volume is registered. More info about the event system can be found here: 70 + # https://felixkratz.github.io/SketchyBar/config/events 71 + 72 + # sketchybar --add item clock right \ 73 + # --set clock update_freq=10 icon= script="$PLUGIN_DIR/clock.sh" \ 74 + # --add item volume right \ 75 + # --set volume script="$PLUGIN_DIR/volume.sh" \ 76 + # --subscribe volume volume_change \ 77 + # --add item battery right \ 78 + # --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \ 79 + # --subscribe battery system_woke power_source_change 80 + 81 + ##### Force all scripts to run the first time (never do this in a script) ##### 82 + sketchybar --update
+6 -6
modules/home/hammerspoon/default.nix
··· 15 15 enable = true; 16 16 configPath = ./init.lua; 17 17 spoons = { 18 - PaperWM = pkgs.fetchFromGitHub { 19 - owner = "mogenson"; 20 - repo = "PaperWM.spoon"; 21 - rev = "41c796a7edd78575aa71b77295672aa0a4a2c3ea"; 22 - sha256 = "0ryck3d6p0rb3zf7wgn83rfn5dqjw98fpbr1cw83jly44sn6d9mv"; 23 - }; 18 + # PaperWM = pkgs.fetchFromGitHub { 19 + # owner = "mogenson"; 20 + # repo = "PaperWM.spoon"; 21 + # rev = "41c796a7edd78575aa71b77295672aa0a4a2c3ea"; 22 + # sha256 = "0ryck3d6p0rb3zf7wgn83rfn5dqjw98fpbr1cw83jly44sn6d9mv"; 23 + # }; 24 24 AutoMuteOnSleep = pkgs.fetchzip { 25 25 url = "https://github.com/Hammerspoon/Spoons/raw/master/Spoons/AutoMuteOnSleep.spoon.zip"; 26 26 sha256 = "13llr8j6iwbd5wvsg9mzmzxz06xsnl6mq83bgbnkyk5jbqhzcvxm";
-89
modules/home/hammerspoon/init.lua
··· 1 - PaperWM = hs.loadSpoon("PaperWM") 2 - 3 - -- Match niri layout settings 4 - PaperWM.window_gap = 16 5 - PaperWM.window_ratios = { 1 / 3, 1 / 2, 2 / 3 } 6 - 7 - PaperWM.swipe_fingers = 3 8 - PaperWM.lift_window = { "alt", "cmd", "shift" } 9 - 10 - -- Niri-like keybindings 11 - -- Niri uses Mod (Super) as the primary modifier. On macOS, cmd is taken by 12 - -- system shortcuts so we use alt as the equivalent of niri's Mod. 13 - -- 14 - -- Niri PaperWM 15 - -- Mod+H/J/K/L -> alt+H/J/K/L focus 16 - -- Mod+Ctrl+H/J/K/L -> alt+ctrl+H/J/K/L move/swap 17 - -- Mod+R -> alt+R cycle width 18 - -- Mod+Shift+R -> alt+shift+R cycle height 19 - -- Mod+F -> alt+F full width 20 - -- Mod+C -> alt+C center 21 - -- Mod+V -> alt+V toggle floating 22 - -- Mod+[ / Mod+] -> alt+[ / alt+] slurp/barf (consume/expel) 23 - -- Mod+- / Mod+= -> alt+- / alt+= decrease/increase width 24 - -- Mod+1-9 -> alt+1-9 switch space 25 - -- Mod+Ctrl+1-9 -> alt+ctrl+1-9 move window to space 26 - 27 - PaperWM:bindHotkeys({ 28 - -- Focus (niri: Mod+H/J/K/L and Mod+Arrows) 29 - focus_left = { { "alt" }, "h" }, 30 - focus_down = { { "alt" }, "j" }, 31 - focus_up = { { "alt" }, "k" }, 32 - focus_right = { { "alt" }, "l" }, 33 - 34 - -- Swap/move (niri: Mod+Ctrl+H/J/K/L and Mod+Ctrl+Arrows) 35 - swap_left = { { "alt", "ctrl" }, "h" }, 36 - swap_down = { { "alt", "ctrl" }, "j" }, 37 - swap_up = { { "alt", "ctrl" }, "k" }, 38 - swap_right = { { "alt", "ctrl" }, "l" }, 39 - 40 - -- Width cycling (niri: Mod+R / Ctrl+Mod+R) 41 - cycle_width = { { "alt" }, "r" }, 42 - reverse_cycle_width = { { "alt", "ctrl" }, "r" }, 43 - 44 - -- Height cycling (niri: Mod+Shift+R / Ctrl+Mod+Shift+R) 45 - cycle_height = { { "alt", "shift" }, "r" }, 46 - reverse_cycle_height = { { "alt", "ctrl", "shift" }, "r" }, 47 - 48 - -- Width adjustments (niri: Mod+Minus / Mod+Equal) 49 - decrease_width = { { "alt" }, "-" }, 50 - increase_width = { { "alt" }, "=" }, 51 - 52 - -- Full width (niri: Mod+F) 53 - full_width = { { "alt" }, "f" }, 54 - 55 - -- Center (niri: Mod+C) 56 - center_window = { { "alt" }, "c" }, 57 - 58 - -- Toggle floating (niri: Mod+V) 59 - toggle_floating = { { "alt" }, "v" }, 60 - 61 - -- Slurp/barf (niri: Mod+[ consume, Mod+] expel) 62 - slurp_in = { { "alt" }, "[" }, 63 - barf_out = { { "alt" }, "]" }, 64 - 65 - -- Switch space (niri: Mod+1-9) 66 - switch_space_1 = { { "alt" }, "1" }, 67 - switch_space_2 = { { "alt" }, "2" }, 68 - switch_space_3 = { { "alt" }, "3" }, 69 - switch_space_4 = { { "alt" }, "4" }, 70 - switch_space_5 = { { "alt" }, "5" }, 71 - switch_space_6 = { { "alt" }, "6" }, 72 - switch_space_7 = { { "alt" }, "7" }, 73 - switch_space_8 = { { "alt" }, "8" }, 74 - switch_space_9 = { { "alt" }, "9" }, 75 - 76 - -- Move window to space (niri: Mod+Ctrl+1-9) 77 - move_window_1 = { { "alt", "ctrl" }, "1" }, 78 - move_window_2 = { { "alt", "ctrl" }, "2" }, 79 - move_window_3 = { { "alt", "ctrl" }, "3" }, 80 - move_window_4 = { { "alt", "ctrl" }, "4" }, 81 - move_window_5 = { { "alt", "ctrl" }, "5" }, 82 - move_window_6 = { { "alt", "ctrl" }, "6" }, 83 - move_window_7 = { { "alt", "ctrl" }, "7" }, 84 - move_window_8 = { { "alt", "ctrl" }, "8" }, 85 - move_window_9 = { { "alt", "ctrl" }, "9" }, 86 - }) 87 - 88 - PaperWM:start() 89 - 90 1 hs.loadSpoon("AutoMuteOnSleep")
+1 -1
modules/home/niri/config.kdl
··· 58 58 } 59 59 60 60 // Uncomment this to make the mouse warp to the center of newly focused windows. 61 - warp-mouse-to-focus 61 + //warp-mouse-to-focus 62 62 63 63 // Focus windows and outputs automatically when moving the mouse into them. 64 64 // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen.
+1
modules/home/profiles/desktop.nix
··· 21 21 ./headless.nix 22 22 ../gl.nix 23 23 ../niri 24 + ../aerospace 24 25 ../hammerspoon 25 26 ../ghostty 26 27 ../zed.nix
-31
modules/system/focus-follows-mouse.nix
··· 1 - { 2 - config, 3 - lib, 4 - pkgs, 5 - ... 6 - }: 7 - let 8 - autoraise = pkgs.autoraise.overrideAttrs (old: { 9 - buildPhase = '' 10 - runHook preBuild 11 - $CXX -std=c++03 -fobjc-arc -D"NS_FORMAT_ARGUMENT(A)=" -D"SKYLIGHT_AVAILABLE=1" -DEXPERIMENTAL_FOCUS_FIRST -o AutoRaise AutoRaise.mm -framework AppKit -framework SkyLight 12 - bash create-app-bundle.sh 13 - runHook postBuild 14 - ''; 15 - }); 16 - in 17 - { 18 - config = lib.mkIf pkgs.stdenv.isDarwin { 19 - environment.systemPackages = [ autoraise ]; 20 - 21 - launchd.user.agents.autoraise = { 22 - command = "${autoraise}/bin/autoraise -delay 0 -focusDelay 1"; 23 - serviceConfig = { 24 - KeepAlive = true; 25 - RunAtLoad = true; 26 - StandardOutPath = "/tmp/autoraise.log"; 27 - StandardErrorPath = "/tmp/autoraise.err.log"; 28 - }; 29 - }; 30 - }; 31 - }