Kaynağa Gözat

feat(aerospace): overhaul keybindings and document setup

This commit introduces a comprehensive overhaul of the window management and keybinding setup for macOS, centralizing on AeroSpace as the primary tiling window manager. The keybindings have been remapped from `alt` to `ctrl` to create a more unified and consistent user experience.

The `README.md` has been significantly updated with a more detailed quick start guide. These new instructions are based on the process of setting up a new macOS machine from scratch, ensuring they are accurate and repeatable.

Kanata has been temporarily disabled for the `meili` host. This is a precautionary measure to ensure the core system and keyboard are fully functional before introducing advanced key remapping layers.

Additionally, this commit includes the following changes:
- The Zen Browser now includes the Dark Reader extension by default.
- Homebrew autoupdates are disabled in favor of managing packages through a `Brewfile`.
Zander Hawke 10 ay önce
ebeveyn
işleme
93f54a3169

+ 23 - 1
README.md

@@ -32,9 +32,31 @@ Each machine has its own system configuration and home-manager setup, with share
 ## Quick Start
 
 ### For macOS (meili)
+
+> Note:
+> There is a thing where the terminal emulator needs full disk access for homebrew and other things to work correctly, but I'm also using Ghostty installed via Homebrew. Therefor, after the `darwin-rebuild switch` a `brew bundle`.
+
 ```bash
+# Install Homebrew
+/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
+
+# Add `darwin-rebuild` to shell
+nix shell github:lnl7/nix-darwin#darwin-rebuild
+
 # Apply system configuration
-nix run github:lnl7/nix-darwin -- switch --flake .#meili
+sudo darwin-rebuild switch --flake .#meili
+
+# Install the brew packages
+brew bundle
+
+# Allow Full Disk Access to Ghossty
+# System Settings
+#   -> Privacy & Security
+#   -> Full Disk Access
+#   -> Add Ghostty
+
+# Apply system configuration one more time
+sudo darwin-rebuild switch --flake .#meili
 
 # Apply home-manager configuration
 nix run github:nix-community/home-manager -- switch --flake .#thomas@meili

+ 3 - 3
flake.lock

@@ -512,11 +512,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1755055213,
-        "narHash": "sha256-smOMNJ6ZM4mKvYB2z1Dbfkttr9fnjqeLT9bqRwn/L1U=",
+        "lastModified": 1755836873,
+        "narHash": "sha256-kqBx9zxViNZsg7rD2zqzOQgCWJF/VNrAn0/T1Q7RuBM=",
         "owner": "0xc000022070",
         "repo": "zen-browser-flake",
-        "rev": "6391f8217d75b9f72b8c77572246937323ed90bc",
+        "rev": "a1bb1b39bee59f537799d9937c6919544c841e5b",
         "type": "github"
       },
       "original": {

+ 97 - 42
home/features/desktop/aerospace.nix

@@ -5,7 +5,7 @@
 }:
 let
   cfg = config.programs.aerospace;
-  aerospace-focus = "${lib.getExe pkgs.unstable.aerospace-tmux-focus}";
+  aerospace-focus = "${lib.getExe pkgs.aerospace-tmux-focus}";
 in
 {
   home.packages = [ pkgs.aerospace-tmux-focus ];
@@ -25,66 +25,121 @@ in
   programs.aerospace = {
     enable = true;
     userSettings = {
+      start-at-login = true;
+
       mode.main.binding = {
-        alt-1 = "workspace 1";
-        alt-2 = "workspace 2";
-        alt-3 = "workspace 3";
-        alt-4 = "workspace 4";
-        alt-5 = "workspace 5";
-        alt-b = "workspace B"; # Browser
-        alt-e = "workspace E"; # Finder
-        alt-m = "workspace M"; # Mail
-        alt-n = "workspace N"; # Notes
-        alt-s = "workspace S"; # Signal
-        alt-t = "workspace T"; # Terminal
-        alt-v = "workspace V"; # Video
-
-        # moving windows to workspaces
-        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-b = "move-node-to-workspace B";
-        alt-shift-e = "move-node-to-workspace E";
-        alt-shift-t = "move-node-to-workspace T";
-        alt-shift-m = "move-node-to-workspace M";
-        alt-shift-n = "move-node-to-workspace N";
-        alt-shift-s = "move-node-to-workspace S";
-        alt-shift-v = "move-node-to-workspace V";
-
-        # focus between windows
+        # window focus
+        ctrl-left = "exec-and-forget ${aerospace-focus} left";
+        ctrl-down = "exec-and-forget ${aerospace-focus} down";
+        ctrl-up = "exec-and-forget ${aerospace-focus} up";
+        ctrl-right = "exec-and-forget ${aerospace-focus} right";
+
+        # vim-style window focusing
         ctrl-h = "exec-and-forget ${aerospace-focus} left";
-        ctrl-l = "exec-and-forget ${aerospace-focus} right";
-        ctrl-k = "exec-and-forget ${aerospace-focus} up";
         ctrl-j = "exec-and-forget ${aerospace-focus} down";
+        ctrl-k = "exec-and-forget ${aerospace-focus} up";
+        ctrl-l = "exec-and-forget ${aerospace-focus} right";
 
-        # move between windows
+        # move windows
+        ctrl-shift-left = "move left";
+        ctrl-shift-down = "move down";
+        ctrl-shift-up = "move up";
+        ctrl-shift-right = "move right";
+
+        # vim-style window moving
         ctrl-shift-h = "move left";
-        ctrl-shift-l = "move right";
-        ctrl-shift-k = "move up";
         ctrl-shift-j = "move down";
+        ctrl-shift-k = "move up";
+        ctrl-shift-l = "move right";
+
+        # jump to workspace
+        ctrl-b = "workspace B"; # Browser
+        ctrl-e = "workspace E"; # Finder
+        ctrl-m = "workspace M"; # Mail
+        ctrl-n = "workspace N"; # Notes
+        ctrl-s = "workspace S"; # Signal
+        ctrl-t = "workspace T"; # Terminal
+        ctrl-v = "workspace V"; # Video
+
+        # move window to workspace
+        ctrl-shift-b = "move-node-to-workspace B";
+        ctrl-shift-e = "move-node-to-workspace E";
+        ctrl-shift-t = "move-node-to-workspace T";
+        ctrl-shift-m = "move-node-to-workspace M";
+        ctrl-shift-n = "move-node-to-workspace N";
+        ctrl-shift-s = "move-node-to-workspace S";
+        ctrl-shift-v = "move-node-to-workspace V";
+
+        # follow window to workspace
+        ctrl-cmd-b = [ "move-node-to-workspace B" "workspace B" ];
+        ctrl-cmd-e = [ "move-node-to-workspace E" "workspace E" ];
+        ctrl-cmd-t = [ "move-node-to-workspace T" "workspace M" ];
+        ctrl-cmd-m = [ "move-node-to-workspace M" "workspace N" ];
+        ctrl-cmd-n = [ "move-node-to-workspace N" "workspace S" ];
+        ctrl-cmd-s = [ "move-node-to-workspace S" "workspace T" ];
+        ctrl-cmd-v = [ "move-node-to-workspace V" "workspace V" ];
+
+        # window management
+        ctrl-q = "close";
+        ctrl-shift-q = "close-all-windows-but-current";
+
+        # fullscreen and floating
+        ctrl-f = "fullscreen";
+        ctrl-shift-f = "layout floating tiling";
+
+        # layout switching
+        ctrl-space = "layout tiles horizontal vertical";
+        ctrl-shift-space = "layout accordion horizontal vertical";
+
+        # resize mode
+        ctrl-r = "mode resize";
+
+        # application launchers; not necessary since we're using app launcher
+        # ctrl-return      = "exec-and-forget open -a Terminal";
+        # ctrl-e           = "exec-and-forget open -a Finder";
+        # ctrl-b           = "exec-and-forget open -a Safari";
+        ctrl-d = "exec-and-forget open -a Raycast";
+
+        # reload configuration; probably not necessary since we're using hm
+        # ctrl-ctrl-r      = "reload-config";
+
+        # resize shortcuts outside of resize mode
+        ctrl-cmd-h = "resize smart -50";
+        ctrl-cmd-l = "resize smart +50";
+        ctrl-cmd-k = "resize smart -50";
+        ctrl-cmd-j = "resize smart +50";
+      };
 
-        alt-shift-minus = "resize smart -50";
-        alt-shift-equal = "resize smart +50";
+      mode.resize.binding = {
+        h = "resize smart -50";
+        l = "resize smart +50";
+        k = "resize smart -50";
+        j = "resize smart +50";
 
-        alt-shift-semicolon = "mode service";
+        left = "resize smart -50";
+        right = "resize smart +50";
+        up = "resize smart -50";
+        down = "resize smart +50";
 
-        alt-slash = "layout tiles horizontal vertical";
-        alt-comma = "layout accordion horizontal vertical";
+        esc = "mode main";
+        ctrl-r = "mode main";
       };
 
       on-window-detected = [
         # disable on "Picture-in-Picture"
         {
-          "if".app-id = "com.brave.Browser";
-          "if".window-title-regex-substring = "Picture in Picture";
           check-further-callbacks = false;
+          "if" = {
+            app-id = "com.brave.Browser";
+            window-title-regex-substring = "Picture in Picture";
+          };
           run = [ "layout floating" ];
         }
         {
-          "if".app-id = "io.zsa.keymapp";
           check-further-callbacks = false;
+          "if" = {
+            app-id = "io.zsa.keymapp";
+          };
           run = [ "layout floating" ];
         }
       ];

+ 5 - 0
home/features/desktop/zen-browser.nix

@@ -43,6 +43,11 @@ in
         install_url = "https://addons.mozilla.org/firefox/downloads/latest/alby/latest.xpi";
         installation_mode = "force_installed";
       };
+
+      "[email protected]" = {
+        install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi";
+        installation_mode = "force_installed";
+      };
     };
   };
 

+ 0 - 2
home/meili.nix

@@ -5,8 +5,6 @@
     ./features/cli
     ./features/desktop
     ./features/nvim
-
-    # ./features/mail.nix
   ];
 
   programs.fish.interactiveShellInit = ''

+ 23 - 0
hosts/meili/README.md

@@ -11,6 +11,11 @@ nix run github:nix-community/home-manager -- switch --flake .#thomas@meili
 
 ## Services and Applications
 
+> 📘 Todo
+> 
+> Move back to skhd, yabai and add sketchybar
+> Or maybe just stay with aerospace: https://www.youtube.com/watch?v=-FoWClVHG5g
+
 ### AeroSpace
 
 i3 style tiling manager
@@ -39,3 +44,21 @@ Ghostty is still broken on darwin systems. But the master branch of home-manager
 ### VLC
 ### Yubi Authenticator
 
+
+
+## Keyboard Mappings
+
+Layers:
+1. Aerospace
+2. Ghostty
+3. Tmux
+4. Vim
+
+### Moving between splits, panes, and spaces
+
+- `ctrl+h`: move left
+- `ctrl+j`: move down
+- `ctrl+k`: move up
+- `ctrl+l`: move right
+
+

+ 1 - 1
hosts/meili/default.nix

@@ -3,7 +3,7 @@
   imports =
     [
       outputs.modules.global.nix-config
-      ./kanata.nix
+      # ./kanata.nix
       ./system.nix
       ./software.nix
     ]

+ 8 - 4
hosts/meili/kanata.kbd

@@ -7,6 +7,10 @@
   ;; macOS typically uses something like this:
   ;; linux-dev /dev/input/by-path/your-keyboard-path
   ;; For macOS, you might need to specify the input device differently
+
+  macos-dev-names-exclude (
+    "Voyager"
+  )
 )
 
 (defsrc
@@ -16,7 +20,7 @@
   ;; tab  q    w    e    r    t    y    u    i    o    p    [    ]    \
        q    w    e    r    t    y    u    i    o    p
   ;; caps a    s    d    f    g    h    j    k    l    ;    '    ret
-       a    s    d    f    g    h    j    k    l    ;
+  caps a    s    d    f    g    h    j    k    l    ;
   ;; lsft z    x    c    v    b    n    m    ,    .    /    rsft
        z    x    c    v    b    n    m    ,    .    /
   ;; fn   lctl lalt lmet           spc           rmet ralt left down up   rght
@@ -27,7 +31,7 @@
 (deflayer base
        brdn brup                                         mute vold volu
        q    w    e    r    t    y    u    i    o    p
-       @a   @s   @d   @f   g    h    @j   @k   @l   @;
+  esc  @a   @s   @d   @f   g    h    @j   @k   @l   @;
        z    x    c    @v   b    n    m    ,    .    /
                  @lmet          spc           ret
 )
@@ -65,8 +69,8 @@
 
 (defvar
   ;; Timing values - adjust based on your typing speed
-  tap-time 175
-  hold-time 200
+  tap-time 135
+  hold-time 135
 
   ;; Define which keys are on each hand for bilateral combinations
   left-hand-keys (q w e r t a s d f g z x c v b)

+ 4 - 4
hosts/meili/software.nix

@@ -38,7 +38,7 @@
       "proton-pass"
       "protonvpn"
 
-      "signal"
+      # "signal"
       "tailscale-app"
       # "tor-browser"
       # "utm"
@@ -49,7 +49,7 @@
 
     masApps = {
       # "Bitwarden" = 1352778147;
-      "Yubico Authenticator" = 1497506650;
+      # "Yubico Authenticator" = 1497506650;
       # "UTM Virtual Machines" = 1538878817; costs $9.99 in the app store
       # "Speechify" = 1624912180;
       # "DaVinci Resolve" = 571213070;
@@ -65,8 +65,8 @@
     };
 
     enable = true;
-    global.autoUpdate = true;
-    onActivation.autoUpdate = true;
+    global.brewfile = true;
     onActivation.cleanup = "zap";
+    onActivation.extraFlags = [ "--verbose" ];
   };
 }