1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00

xresources: join lists with a ","

This commit is contained in:
Roman Volosatovs 2018-07-22 20:57:01 +02:00 committed by Robert Helgesson
parent 6694330bb2
commit cf80199bfc
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -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.