mirror of
https://github.com/nix-community/home-manager
synced 2024-12-23 18:29:47 +01:00
polybar: only quote strings if needed
Polybar expects quoted values only when whitespace is important to the value. Fixes #356
This commit is contained in:
parent
859c132ee2
commit
629d66e0b9
1 changed files with 6 additions and 1 deletions
|
@ -11,9 +11,14 @@ let
|
|||
toPolybarIni = generators.toINI {
|
||||
mkKeyValue = key: value:
|
||||
let
|
||||
quoted = v:
|
||||
if hasPrefix " " v || hasSuffix " " v
|
||||
then ''"${v}"''
|
||||
else v;
|
||||
|
||||
value' =
|
||||
if isBool value then (if value then "true" else "false")
|
||||
else if (isString value && key != "include-file") then ''"${value}"''
|
||||
else if (isString value && key != "include-file") then quoted value
|
||||
else toString value;
|
||||
in
|
||||
"${key}=${value'}";
|
||||
|
|
Loading…
Reference in a new issue