diff --git a/modules/programs/pqiv.nix b/modules/programs/pqiv.nix index 046ed9aa9..ed1a0b280 100644 --- a/modules/programs/pqiv.nix +++ b/modules/programs/pqiv.nix @@ -3,12 +3,10 @@ with lib; let - cfg = config.programs.pqiv; iniFormat = pkgs.formats.ini { }; - in { - meta.maintainers = with lib.maintainers; [ donovanglover ]; + meta.maintainers = with lib.maintainers; [ donovanglover iynaix ]; options.programs.pqiv = { enable = mkEnableOption "pqiv image viewer"; @@ -24,10 +22,9 @@ in { type = iniFormat.type; default = { }; description = '' - Configuration written to - $XDG_CONFIG_HOME/pqivrc. See - for a list of available options. To set a boolean flag, set the value to 1. + 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. ''; 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 { @@ -49,8 +65,12 @@ in { home.packages = [ cfg.package ]; - xdg.configFile."pqivrc" = mkIf (cfg.settings != { }) { - source = iniFormat.generate "pqivrc" cfg.settings; - }; + xdg.configFile."pqivrc" = + mkIf (cfg.settings != { } && cfg.extraConfig != "") { + text = lib.concatLines [ + (generators.toINI { } cfg.settings) + cfg.extraConfig + ]; + }; }; } diff --git a/tests/modules/programs/pqiv/settings.nix b/tests/modules/programs/pqiv/settings.nix index 6a5abe604..277203da5 100644 --- a/tests/modules/programs/pqiv/settings.nix +++ b/tests/modules/programs/pqiv/settings.nix @@ -10,6 +10,10 @@ thumbnail-size = "256x256"; }; }; + extraConfig = '' + [keybindings] + t { montage_mode_enter() } + ''; }; nmt.script = '' @@ -19,6 +23,10 @@ [options] hide-info-box=1 thumbnail-size=256x256 + + [keybindings] + t { montage_mode_enter() } + '' } '';