rofi: add support for lists in rasi (#1768)

This is now supported without the need of using to represent them:
9a843caa86/Official%20Themes/solarized.rasi (L134)
This commit is contained in:
Thiago Kenji Okada 2021-02-03 20:48:34 -03:00 committed by GitHub
parent 9dad146639
commit 3f2f7f8efa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 4 deletions

View file

@ -112,6 +112,8 @@ let
value.value value.value
else if isString value then else if isString value then
''"${value}"'' ''"${value}"''
else if isList value then
"[ ${strings.concatStringsSep "," (map mkValueString value)} ]"
else else
abort "Unhandled value type ${builtins.typeOf value}"; abort "Unhandled value type ${builtins.typeOf value}";
@ -145,7 +147,9 @@ let
left = 8; left = 8;
}; };
configType = with types; attrsOf (oneOf [ str int bool rasiLiteral ]); primitive = with types; (oneOf [ str int bool rasiLiteral ]);
configType = with types; attrsOf (either primitive (listOf primitive));
rasiLiteral = types.submodule { rasiLiteral = types.submodule {
options = { options = {
@ -331,15 +335,20 @@ in {
default = null; default = null;
type = with types; nullOr (oneOf [ str path themeType ]); type = with types; nullOr (oneOf [ str path themeType ]);
example = literalExample '' example = literalExample ''
with config.lib.formats.rasi; { let
inherit (config.lib.formats.rasi) mkLiteral;
in {
"*" = { "*" = {
# config.lib.formats.rasi.mkLiteral unquotes the value
background-color = mkLiteral "#000000"; background-color = mkLiteral "#000000";
foreground-color = mkLiteral "rgba ( 250, 251, 252, 100 % )"; foreground-color = mkLiteral "rgba ( 250, 251, 252, 100 % )";
border-color = mkLiteral "#FFFFFF"; border-color = mkLiteral "#FFFFFF";
width = 512; width = 512;
}; };
"#inputbar" = {
children = map mkLiteral [ "prompt" "entry" ];
};
"#textbox-prompt-colon" = { "#textbox-prompt-colon" = {
expand = false; expand = false;
str = ":"; str = ":";

View file

@ -7,7 +7,8 @@ with lib;
programs.rofi = { programs.rofi = {
enable = true; enable = true;
theme = with config.lib.formats.rasi; { theme = let inherit (config.lib.formats.rasi) mkLiteral;
in {
"*" = { "*" = {
background-color = mkLiteral "#000000"; background-color = mkLiteral "#000000";
foreground-color = mkLiteral "rgba ( 250, 251, 252, 100 % )"; foreground-color = mkLiteral "rgba ( 250, 251, 252, 100 % )";
@ -15,6 +16,8 @@ with lib;
width = 512; width = 512;
}; };
"#inputbar" = { children = map mkLiteral [ "prompt" "entry" ]; };
"#textbox-prompt-colon" = { "#textbox-prompt-colon" = {
expand = false; expand = false;
str = ":"; str = ":";

View file

@ -1,3 +1,7 @@
#inputbar {
children: [ prompt,entry ];
}
#textbox-prompt-colon { #textbox-prompt-colon {
expand: false; expand: false;
margin: 0px 0.3em 0em 0em; margin: 0px 0.3em 0em 0em;