1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-28 18:57:08 +00:00

Merge pull request #58 from pjan/enh/dock_settings

Adds attrs type for defaults. Adds additional Dock settings.
This commit is contained in:
Daiderd Jordan 2018-01-01 14:30:18 +01:00 committed by GitHub
commit 7aadb77aaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 117 additions and 10 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.swp

View file

@ -6,11 +6,14 @@ let
cfg = config.system.defaults;
isFloat = x: isString x && builtins.match "^[+-]?([0-9]*[.])?[0-9]+$" x != null;
boolValue = x: if x then "YES" else "NO";
writeValue = value:
if isBool value then "-bool ${boolValue value}" else
if isInt value then "-int ${toString value}" else
if isFloat value then "-float ${toString value}" else
if isString value then "-string '${value}'" else
throw "invalid value type";

View file

@ -2,7 +2,17 @@
with lib;
{
let
isFloat = x: isString x && builtins.match "^[+-]?([0-9]*[.])?[0-9]+$" x != null;
float = mkOptionType {
name = "float";
description = "float";
check = isFloat;
merge = options.mergeOneOption;
};
in {
options = {
system.defaults.dock.autohide = mkOption {
@ -13,27 +23,70 @@ with lib;
'';
};
system.defaults.dock.orientation = mkOption {
type = types.nullOr (types.enum [ "bottom" "left" "right" ]);
system.defaults.dock.autohide-delay = mkOption {
type = types.nullOr float;
default = null;
example = "0.24";
description = ''
Position of the dock on screen. The default is "bottom".
Sets the speed of the autohide delay. The default is given in the example.
'';
};
system.defaults.dock.showhidden = mkOption {
system.defaults.dock.autohide-time-modifier = mkOption {
type = types.nullOr float;
default = null;
example = "1.0";
description = ''
Sets the speed of the animation when hiding/showing the Dock. The default is given in the example.
'';
};
system.defaults.dock.dashboard-in-overlay = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Whether to make icons of hidden applications tranclucent. The default is false.
Whether to hide Dashboard as a Space. The default is false;
'';
};
system.defaults.dock.tilesize = mkOption {
type = types.nullOr types.int;
system.defaults.dock.enable-spring-load-actions-on-all-items = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Size of the icons in the dock. The default is 64.
Enable spring loading for all Dock items. The default is false;
'';
};
system.defaults.dock.expose-animation-duration = mkOption {
type = types.nullOr float;
default = null;
example = "1.0";
description = ''
Sets the speed of the Mission Control animations. The default is given in the example.
'';
};
system.defaults.dock.expose-group-by-app = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Whether to group windows by application in Mission Control's Exposé. The default is true.
'';
};
system.defaults.dock.launchanim = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Animate opening applications from the Dock. The default is true.
'';
};
system.defaults.dock.mineffect = mkOption {
type = types.nullOr (types.enum [ "genie" "suck" "scale" ]);
default = null;
description = ''
Set the minimize/maximize window effect. The default is genie.
'';
};
@ -45,6 +98,14 @@ with lib;
'';
};
system.defaults.dock.mouse-over-hilite-stack = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Enable highlight hover effect for the grid view of a stack in the Dock.
'';
};
system.defaults.dock.mru-spaces = mkOption {
type = types.nullOr types.bool;
default = null;
@ -53,5 +114,45 @@ with lib;
'';
};
};
system.defaults.dock.orientation = mkOption {
type = types.nullOr (types.enum [ "bottom" "left" "right" ]);
default = null;
description = ''
Position of the dock on screen. The default is "bottom".
'';
};
system.defaults.dock.show-process-indicators = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Show indicator lights for open applications in the Dock. The default is true.
'';
};
system.defaults.dock.showhidden = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Whether to make icons of hidden applications tranclucent. The default is false.
'';
};
system.defaults.dock.static-only = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Show only open applications in the Dock. The default is false.
'';
};
system.defaults.dock.tilesize = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
Size of the icons in the dock. The default is 64.
'';
};
};
}

View file

@ -2,11 +2,13 @@
{
system.defaults.NSGlobalDomain.KeyRepeat = 1;
system.defaults.dock.autohide-delay = "0.24";
system.defaults.dock.orientation = "left";
test = ''
echo checking defaults write in /activate-user >&2
grep "defaults write -g 'KeyRepeat' -int 1" ${config.out}/activate-user
grep "defaults write com.apple.dock 'orientation' -string 'left'" ${config.out}/activate-user
grep "defaults write com.apple.dock 'autohide-delay' -float 0.24" ${config.out}/activate-user
'';
}