1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

pqiv: add boolean support

This commit is contained in:
Donovan Glover 2024-09-08 11:10:43 -04:00 committed by Robert Helgesson
parent be47a2bdf2
commit 10541f19c5
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
2 changed files with 15 additions and 8 deletions

View file

@ -23,14 +23,13 @@ in {
default = { };
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/pqivrc`. See
{manpage}`pqiv(1)` for a list of available options. To set a
boolean flag, set the value to 1.
{manpage}`pqiv(1)` for a list of available options.
'';
example = literalExpression ''
{
options = {
lazy-load = 1;
hide-info-box = 1;
lazy-load = true;
hide-info-box = true;
background-pattern = "black";
thumbnail-size = "256x256";
command-1 = "thunar";
@ -68,7 +67,15 @@ in {
xdg.configFile."pqivrc" =
mkIf (cfg.settings != { } && cfg.extraConfig != "") {
text = lib.concatLines [
(generators.toINI { } cfg.settings)
(generators.toINI {
mkKeyValue = key: value:
let
value' = if isBool value then
(if value then "1" else "0")
else
toString value;
in "${key} = ${value'}";
} cfg.settings)
cfg.extraConfig
];
};

View file

@ -6,7 +6,7 @@
package = config.lib.test.mkStubPackage { name = "pqiv"; };
settings = {
options = {
hide-info-box = 1;
hide-info-box = true;
thumbnail-size = "256x256";
};
};
@ -21,8 +21,8 @@
assertFileContent home-files/.config/pqivrc ${
builtins.toFile "pqiv.expected" ''
[options]
hide-info-box=1
thumbnail-size=256x256
hide-info-box = 1
thumbnail-size = 256x256
[keybindings]
t { montage_mode_enter() }