1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-09-11 12:49:18 +03:00

add options for configuring activity monitor

This commit is contained in:
Dan Yang 2022-03-10 18:53:55 -08:00
parent 17fbc68a61
commit faaa12ad24
4 changed files with 77 additions and 0 deletions

View File

@ -22,6 +22,7 @@
./system/defaults/spaces.nix
./system/defaults/trackpad.nix
./system/defaults/universalaccess.nix
./system/defaults/ActivityMonitor.nix
./system/etc.nix
./system/keyboard.nix
./system/launchd.nix

View File

@ -40,6 +40,7 @@ let
trackpad = defaultsToList "com.apple.AppleMultitouchTrackpad" cfg.trackpad;
trackpadBluetooth = defaultsToList "com.apple.driver.AppleBluetoothMultitouch.trackpad" cfg.trackpad;
universalaccess = defaultsToList "com.apple.universalaccess" cfg.universalaccess;
ActivityMonitor = defaultsToList "com.apple.ActivityMonitor" cfg.ActivityMonitor;
mkIfAttrs = list: mkIf (any (attrs: attrs != { }) list);
in
@ -76,6 +77,7 @@ in
trackpad
trackpadBluetooth
universalaccess
ActivityMonitor
]
''
# Set defaults
@ -94,6 +96,7 @@ in
${concatStringsSep "\n" trackpad}
${concatStringsSep "\n" trackpadBluetooth}
${concatStringsSep "\n" universalaccess}
${concatStringsSep "\n" ActivityMonitor}
'';
};

View File

@ -0,0 +1,63 @@
{ config, lib, ... }:
with lib;
{
options = {
system.defaults.ActivityMonitor.ShowCategory = mkOption {
type = types.nullOr (types.enum [100 101 102 103 104 105 106 107]);
default = 100;
description = ''
Change which processes to show.
100: All Processes
101: All Processes, Hierarchally
102: My Processes
103: System Processes
104: Other User Processes
105: Active Processes
106: Inactive Processes
107: Windowed Processes
Default is 100.
'';
};
system.defaults.ActivityMonitor.IconType = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
Change the icon in the dock when running.
0: Application Icon
2: Network Usage
3: Disk Activity
5: CPU Usage
6: CPU History
Default is null.
'';
};
system.defaults.ActivityMonitor.SortColumn = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Which column to sort the main activity page (such as "CPUUsage"). Default is null.
'';
};
system.defaults.ActivityMonitor.SortDirection = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
The sort direction of the sort column (0 is decending). Default is null.
'';
};
system.defaults.ActivityMonitor.OpenMainWindow = mkOption {
type = types.nullOr types.bool;
default = true;
description = ''
Open the main window when opening Activity Monitor. Default is true.
'';
};
};
}

View File

@ -42,6 +42,11 @@
system.defaults.universalaccess.reduceTransparency = true;
system.defaults.universalaccess.closeViewScrollWheelToggle = true;
system.defaults.universalaccess.closeViewZoomFollowsFocus = true;
system.defaults.ActivityMonitor.ShowCategory = 103;
system.defaults.ActivityMonitor.IconType = 3;
system.defaults.ActivityMonitor.SortColumn = "CPUUsage";
system.defaults.ActivityMonitor.SortDirection = 0;
system.defaults.ActivityMonitor.OpenMainWindow = true;
test = ''
echo >&2 "checking defaults write in /activate"
@ -88,5 +93,10 @@
grep "defaults write com.apple.universalaccess 'reduceTransparency' -bool YES" ${config.out}/activate-user
grep "defaults write com.apple.universalaccess 'closeViewScrollWheelToggle' -bool YES" ${config.out}/activate-user
grep "defaults write com.apple.universalaccess 'closeViewZoomFollowsFocus' -bool YES" ${config.out}/activate-user
grep "defaults write com.apple.ActivityMonitor 'ShowCategory' -int 103" ${config.out}/activate-user
grep "defaults write com.apple.ActivityMonitor 'IconType' -int 3" ${config.out}/activate-user
grep "defaults write com.apple.ActivityMonitor 'SortColumn' -string 'CPUUsage'" ${config.out}/activate-user
grep "defaults write com.apple.ActivityMonitor 'SortDirection' -int 0" ${config.out}/activate-user
grep "defaults write com.apple.ActivityMonitor 'OpenMainWindow' -bool YES" ${config.out}/activate-user
'';
}