Skip to content

Commit

Permalink
Spotligh: move from controlcenter to separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
Iamanaws committed Feb 21, 2025
1 parent 20d05f8 commit 9ed9dd6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
1 change: 1 addition & 0 deletions modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
./system/applications.nix
./system/defaults-write.nix
./system/defaults/controlcenter.nix
./system/defaults/Spotlight.nix
./system/defaults/LaunchServices.nix
./system/defaults/NSGlobalDomain.nix
./system/defaults/GlobalPreferences.nix
Expand Down
3 changes: 3 additions & 0 deletions modules/system/defaults-write.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ let
ActivityMonitor = defaultsToList "com.apple.ActivityMonitor" cfg.ActivityMonitor;
WindowManager = defaultsToList "com.apple.WindowManager" cfg.WindowManager;
controlcenter = defaultsToList "~/Library/Preferences/ByHost/com.apple.controlcenter" cfg.controlcenter;
Spotlight = defaultsToList "~/Library/Preferences/ByHost/com.apple.Spotlight" cfg.Spotlight;
CustomUserPreferences = flatten (mapAttrsToList (name: value: defaultsToList name value) cfg.CustomUserPreferences);
CustomSystemPreferences = flatten (mapAttrsToList (name: value: defaultsToList name value) cfg.CustomSystemPreferences);

Expand Down Expand Up @@ -95,6 +96,7 @@ in
CustomUserPreferences
WindowManager
controlcenter
Spotlight
]
''
# Set defaults
Expand All @@ -120,6 +122,7 @@ in
${concatStringsSep "\n" CustomUserPreferences}
${concatStringsSep "\n" WindowManager}
${concatStringsSep "\n" controlcenter}
${concatStringsSep "\n" Spotlight}
${optionalString (length dock > 0) ''
# Only restart Dock if current user is logged in
Expand Down
18 changes: 18 additions & 0 deletions modules/system/defaults/Spotlight.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ config, lib, ... }:

{
options = {
system.defaults.Spotlight.MenuItemHidden = lib.mkOption {
type = lib.types.nullOr lib.types.bool;
default = null;
description = ''
Apple menu > System Preferences > Control Center > Menu Bar Only > Spotlight
Show Spotlight in menu bar. Default is null.
false - "Don't Show in Menu Bar"
true - "Show in Menu Bar"
'';
};
};
}
13 changes: 0 additions & 13 deletions modules/system/defaults/controlcenter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -332,19 +332,6 @@ in
'';
};

system.defaults.controlcenter.Spotlight = lib.mkOption {
type = lib.types.nullOr lib.types.bool;
default = null;
description = ''
Apple menu > System Preferences > Control Center > Menu Bar Only > Spotlight
Show Spotlight in menu bar. Default is null.
false - "Don't Show in Menu Bar"
true - "Show in Menu Bar"
'';
};

system.defaults.controlcenter.StageManager = lib.mkOption {
type = lib.types.nullOr lib.types.bool;
default = null;
Expand Down
2 changes: 1 addition & 1 deletion tests/system-defaults-write.nix
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
system.defaults.controlcenter.NowPlaying = "always";
system.defaults.controlcenter.ScreenMirroring = "whenActive";
system.defaults.controlcenter.Sound = "whenActive";
system.defaults.controlcenter.Spotlight = true;
system.defaults.Spotlight.MenuItemHidden = true;
system.defaults.controlcenter.StageManager = true;
system.defaults.controlcenter.UserSwitcher = "both";
system.defaults.controlcenter.WiFi = true;
Expand Down

0 comments on commit 9ed9dd6

Please sign in to comment.