1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01: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 = { }; default = { };
description = '' description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/pqivrc`. See Configuration written to {file}`$XDG_CONFIG_HOME/pqivrc`. See
{manpage}`pqiv(1)` for a list of available options. To set a {manpage}`pqiv(1)` for a list of available options.
boolean flag, set the value to 1.
''; '';
example = literalExpression '' example = literalExpression ''
{ {
options = { options = {
lazy-load = 1; lazy-load = true;
hide-info-box = 1; hide-info-box = true;
background-pattern = "black"; background-pattern = "black";
thumbnail-size = "256x256"; thumbnail-size = "256x256";
command-1 = "thunar"; command-1 = "thunar";
@ -68,7 +67,15 @@ in {
xdg.configFile."pqivrc" = xdg.configFile."pqivrc" =
mkIf (cfg.settings != { } && cfg.extraConfig != "") { mkIf (cfg.settings != { } && cfg.extraConfig != "") {
text = lib.concatLines [ 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 cfg.extraConfig
]; ];
}; };

View file

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