1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-24 18:59: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:
Jonathan Reeve 2018-08-26 14:32:00 -04:00 committed by Robert Helgesson
parent 859c132ee2
commit 629d66e0b9
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -11,9 +11,14 @@ let
toPolybarIni = generators.toINI { toPolybarIni = generators.toINI {
mkKeyValue = key: value: mkKeyValue = key: value:
let let
quoted = v:
if hasPrefix " " v || hasSuffix " " v
then ''"${v}"''
else v;
value' = value' =
if isBool value then (if value then "true" else "false") 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; else toString value;
in in
"${key}=${value'}"; "${key}=${value'}";