1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-19 00:09:48 +01:00

pqiv: add extraConfig option

This commit is contained in:
Lin Xianyi 2024-03-10 17:20:21 +08:00 committed by GitHub
parent fe4180ad3f
commit 36f873dfc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 38 additions and 10 deletions

View file

@ -3,12 +3,10 @@
with lib; with lib;
let let
cfg = config.programs.pqiv; cfg = config.programs.pqiv;
iniFormat = pkgs.formats.ini { }; iniFormat = pkgs.formats.ini { };
in { in {
meta.maintainers = with lib.maintainers; [ donovanglover ]; meta.maintainers = with lib.maintainers; [ donovanglover iynaix ];
options.programs.pqiv = { options.programs.pqiv = {
enable = mkEnableOption "pqiv image viewer"; enable = mkEnableOption "pqiv image viewer";
@ -24,10 +22,9 @@ in {
type = iniFormat.type; type = iniFormat.type;
default = { }; default = { };
description = '' description = ''
Configuration written to Configuration written to {file}`$XDG_CONFIG_HOME/pqivrc`. See
<filename>$XDG_CONFIG_HOME/pqivrc</filename>. See <link {manpage}`pqiv(1)` for a list of available options. To set a
xlink:href="https://github.com/phillipberndt/pqiv/blob/master/pqiv.1"/> boolean flag, set the value to 1.
for a list of available options. To set a boolean flag, set the value to 1.
''; '';
example = literalExpression '' example = literalExpression ''
{ {
@ -41,6 +38,25 @@ in {
}; };
''; '';
}; };
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Extra lines to be added to {file}`$XDG_CONFIG_HOME/pqivrc`. See
{manpage}`pqiv(1)` for a list of available options.
'';
example = literalExpression ''
[actions]
set_cursor_auto_hide(1)
[keybindings]
t { montage_mode_enter() }
@MONTAGE {
t { montage_mode_return_cancel() }
}
'';
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -49,8 +65,12 @@ in {
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
xdg.configFile."pqivrc" = mkIf (cfg.settings != { }) { xdg.configFile."pqivrc" =
source = iniFormat.generate "pqivrc" cfg.settings; mkIf (cfg.settings != { } && cfg.extraConfig != "") {
}; text = lib.concatLines [
(generators.toINI { } cfg.settings)
cfg.extraConfig
];
};
}; };
} }

View file

@ -10,6 +10,10 @@
thumbnail-size = "256x256"; thumbnail-size = "256x256";
}; };
}; };
extraConfig = ''
[keybindings]
t { montage_mode_enter() }
'';
}; };
nmt.script = '' nmt.script = ''
@ -19,6 +23,10 @@
[options] [options]
hide-info-box=1 hide-info-box=1
thumbnail-size=256x256 thumbnail-size=256x256
[keybindings]
t { montage_mode_enter() }
'' ''
} }
''; '';