khal: added options 'color' and 'priority'
This commit is contained in:
parent
8e49f65f24
commit
faabf67f93
|
@ -20,5 +20,26 @@ with lib;
|
|||
type is set to discover.
|
||||
'';
|
||||
};
|
||||
|
||||
color = mkOption {
|
||||
type = types.nullOr (types.enum [
|
||||
"black" "white" "brown" "yellow" "dark gray" "dark green" "dark blue"
|
||||
"light gray" "light green" "light blue" "dark magenta" "dark cyan"
|
||||
"dark red" "light magenta" "light cyan" "light red"
|
||||
]);
|
||||
default = null;
|
||||
description = ''
|
||||
Color in which events in this calendar are displayed.
|
||||
'';
|
||||
example = "light green";
|
||||
};
|
||||
|
||||
priority = mkOption {
|
||||
type = types.int;
|
||||
default = 10;
|
||||
description = ''
|
||||
Priority of a calendar used for coloring.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ let
|
|||
findSingle (a: a.primary) null null
|
||||
(mapAttrsToList (n: v: v // {name= n;}) khalAccounts);
|
||||
|
||||
toKeyValueListIfDefined = attrs:
|
||||
mapAttrsToList (n: v: "${n} = ${toString v}")
|
||||
(filterAttrs (_: v: !isNull v) attrs);
|
||||
|
||||
genCalendarStr = name: value:
|
||||
concatStringsSep "\n" (
|
||||
[
|
||||
|
@ -27,7 +31,7 @@ let
|
|||
"path = ${value.local.path + "/" + (optionalString (value.khal.type == "discover") value.khal.glob)}"
|
||||
]
|
||||
++ optional (value.khal.readOnly) "readonly = True"
|
||||
++ optional (!isNull value.khal.type) "type = ${value.khal.type}"
|
||||
++ toKeyValueListIfDefined (getAttrs [ "type" "color" "priority" ] value.khal)
|
||||
++ ["\n"]
|
||||
);
|
||||
|
||||
|
@ -52,7 +56,6 @@ in
|
|||
default = optionalAttrs (!isNull primaryAccount) {
|
||||
default_calendar = if isNull primaryAccount.primaryCollection then primaryAccount.name else primaryAccount.primaryCollection;
|
||||
};
|
||||
|
||||
locale = {
|
||||
timeformat = "%H:%M";
|
||||
dateformat = "%Y-%m-%d";
|
||||
|
|
Loading…
Reference in a new issue