From 7e8bd33c89bde3d900096bff473c4c04597e855b Mon Sep 17 00:00:00 2001 From: moons Date: Tue, 28 Jul 2026 01:01:21 +0900 Subject: [PATCH] mac --- AGENTS.md | 5 ++++- modules/applications/finder/darwin.nix | 15 +++++++++++++++ modules/profiles/interface/macos/meta.nix | 2 ++ modules/systems/keyboard/darwin.nix | 11 +++++++---- modules/systems/macos-defaults/darwin.nix | 21 +++++++++++++++++++++ 5 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 modules/applications/finder/darwin.nix create mode 100644 modules/systems/macos-defaults/darwin.nix diff --git a/AGENTS.md b/AGENTS.md index a892064..32ad795 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,8 +40,10 @@ Prefer the following placements: | Nix settings shared by every system host | `modules/systems/nix/common.nix` | | NixOS-only boot configuration | `modules/systems/boot/.../nixos.nix` | | Disko NixOS module and CLI | `modules/systems/disko/` | +| macOS-wide input, document, and dialog defaults | `modules/systems/macos-defaults/darwin.nix` | | macOS Dock defaults | `modules/systems/dock/darwin.nix` | | macOS trackpad defaults | `modules/systems/trackpad/darwin.nix` | +| Finder-specific preferences | `modules/applications/finder/darwin.nix` | | Ghostty-specific configuration | `modules/applications/ghostty/` | | niri-specific configuration | `modules/applications/niri/` | | Desktop applications shared by GNOME and niri | `modules/profiles/interface/linux-desktop/meta.nix` | @@ -371,7 +373,8 @@ The profile layers have these responsibilities: - `interface` describes how the host is operated. `interface.cli` is shared by NixOS and macOS and includes `tio`. `interface.gui` owns cross-platform graphical interface applications such as Vicinae. `interface.macos` owns the - macOS Dock and trackpad defaults and includes `interface.gui`. + macOS Finder, Dock, trackpad, and shared default preferences and includes + `interface.gui`. `interface.linux-desktop` owns the common GNOME/niri desktop selection, including Ghostty and Nautilus, and also includes `interface.gui`. GNOME and niri remain independently selectable and do not imply CLI or personal diff --git a/modules/applications/finder/darwin.nix b/modules/applications/finder/darwin.nix new file mode 100644 index 0000000..03bfd99 --- /dev/null +++ b/modules/applications/finder/darwin.nix @@ -0,0 +1,15 @@ +{ + system.defaults.finder = { + AppleShowAllExtensions = true; + AppleShowAllFiles = false; + ShowPathbar = true; + ShowStatusBar = true; + _FXShowPosixPathInTitle = true; + _FXSortFoldersFirst = true; + FXDefaultSearchScope = "SCcf"; + FXPreferredViewStyle = "Nlsv"; + NewWindowTarget = "Home"; + FXEnableExtensionChangeWarning = true; + FXRemoveOldTrashItems = true; + }; +} diff --git a/modules/profiles/interface/macos/meta.nix b/modules/profiles/interface/macos/meta.nix index 59015ee..fe5a630 100644 --- a/modules/profiles/interface/macos/meta.nix +++ b/modules/profiles/interface/macos/meta.nix @@ -3,8 +3,10 @@ includes = [ "profiles.interface.gui" + "applications.finder" "systems.dock" "systems.keyboard" + "systems.macos-defaults" "systems.trackpad" ]; } diff --git a/modules/systems/keyboard/darwin.nix b/modules/systems/keyboard/darwin.nix index bad5e0c..c69f51d 100644 --- a/modules/systems/keyboard/darwin.nix +++ b/modules/systems/keyboard/darwin.nix @@ -11,7 +11,13 @@ }; system.defaults = { - NSGlobalDomain."com.apple.keyboard.fnState" = true; + NSGlobalDomain = { + # Keep editor-friendly key repeat behavior and use F1–F12 directly. + ApplePressAndHoldEnabled = false; + InitialKeyRepeat = 15; + KeyRepeat = 2; + "com.apple.keyboard.fnState" = true; + }; # These are the standard macOS App Shortcuts for all applications. Keep # both English and Japanese menu titles so they work after changing the @@ -21,9 +27,6 @@ "Close Window" = "~q"; "閉じる" = "~q"; "ウインドウを閉じる" = "~q"; - "Zoom" = "~f"; - "拡大/縮小" = "~f"; - "拡大/縮小" = "~f"; }; }; } diff --git a/modules/systems/macos-defaults/darwin.nix b/modules/systems/macos-defaults/darwin.nix new file mode 100644 index 0000000..3fa8179 --- /dev/null +++ b/modules/systems/macos-defaults/darwin.nix @@ -0,0 +1,21 @@ +{ + system.defaults.NSGlobalDomain = { + # Prevent automatic text substitutions from changing code and Markdown. + NSAutomaticCapitalizationEnabled = false; + NSAutomaticDashSubstitutionEnabled = false; + NSAutomaticPeriodSubstitutionEnabled = false; + NSAutomaticQuoteSubstitutionEnabled = false; + NSAutomaticSpellingCorrectionEnabled = false; + + # Keep new documents local by default and expand save/print panels. + NSDocumentSaveNewDocumentsToCloud = false; + NSNavPanelExpandedStateForSaveMode = true; + NSNavPanelExpandedStateForSaveMode2 = true; + PMPrintingExpandedStateForPrint = true; + PMPrintingExpandedStateForPrint2 = true; + }; + + # Do not restore applications that happened to be open at logout. Declarative + # launch agents remain the only applications intentionally started at login. + system.defaults.CustomUserPreferences."com.apple.loginwindow".TALLogoutSavesState = false; +}