xresources: join lists with a ","
This commit is contained in:
parent
6694330bb2
commit
cf80199bfc
|
@ -8,11 +8,17 @@ let
|
||||||
|
|
||||||
formatLine = n: v:
|
formatLine = n: v:
|
||||||
let
|
let
|
||||||
v' =
|
formatList = x:
|
||||||
|
if isList x
|
||||||
|
then throw "can not convert 2-dimensional lists to Xresources format"
|
||||||
|
else formatValue x;
|
||||||
|
|
||||||
|
formatValue = v:
|
||||||
if isBool v then (if v then "true" else "false")
|
if isBool v then (if v then "true" else "false")
|
||||||
|
else if isList v then concatMapStringsSep ", " formatList v
|
||||||
else toString v;
|
else toString v;
|
||||||
in
|
in
|
||||||
"${n}: ${v'}";
|
"${n}: ${formatValue v}";
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -24,11 +30,16 @@ in
|
||||||
type = types.nullOr types.attrs;
|
type = types.nullOr types.attrs;
|
||||||
default = null;
|
default = null;
|
||||||
example = {
|
example = {
|
||||||
"XTerm*faceName" = "dejavu sans mono";
|
|
||||||
"Emacs*toolBar" = 0;
|
"Emacs*toolBar" = 0;
|
||||||
|
"XTerm*faceName" = "dejavu sans mono";
|
||||||
|
"XTerm*charClass" = [ "37:48" "45-47:48" "58:48" "64:48" "126:48" ];
|
||||||
};
|
};
|
||||||
description = ''
|
description = ''
|
||||||
X server resources that should be set.
|
X server resources that should be set.
|
||||||
|
Booleans are formatted as "true" or "false" respectively.
|
||||||
|
List elements are recursively formatted as a string and joined by commas.
|
||||||
|
All other values are directly formatted using builtins.toString.
|
||||||
|
Note, that 2-dimensional lists are not supported and specifying one will throw an exception.
|
||||||
If this and all other xresources options are
|
If this and all other xresources options are
|
||||||
<code>null</code>, then this feature is disabled and no
|
<code>null</code>, then this feature is disabled and no
|
||||||
<filename>~/.Xresources</filename> link is produced.
|
<filename>~/.Xresources</filename> link is produced.
|
||||||
|
|
Loading…
Reference in a new issue