mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-15 17:50:53 +00:00
42 lines
943 B
Nix
42 lines
943 B
Nix
|
{ config, lib, pkgs, ... }:
|
||
|
|
||
|
with lib;
|
||
|
|
||
|
let
|
||
|
|
||
|
cfg = config.programs.feh;
|
||
|
|
||
|
disableBinding = func: key: func;
|
||
|
enableBinding = func: key: "${func} ${key}";
|
||
|
|
||
|
in
|
||
|
|
||
|
{
|
||
|
options.programs.feh = {
|
||
|
enable = mkEnableOption "feh - a fast and light image viewer";
|
||
|
|
||
|
keybindings = mkOption {
|
||
|
default = {};
|
||
|
type = types.attrs;
|
||
|
example = { zoom_in = "plus"; zoom_out = "minus"; };
|
||
|
description = ''
|
||
|
Set keybindings.
|
||
|
See <link xlink:href="https://man.finalrewind.org/1/feh/#x4b455953"/> for
|
||
|
default bindings and available commands.
|
||
|
'';
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
home.packages = [ pkgs.feh ];
|
||
|
|
||
|
home.file.".config/feh/keys".text = ''
|
||
|
# Disable default keybindings
|
||
|
${concatStringsSep "\n" (mapAttrsToList disableBinding cfg.keybindings)}
|
||
|
|
||
|
# Enable new keybindings
|
||
|
${concatStringsSep "\n" (mapAttrsToList enableBinding cfg.keybindings)}
|
||
|
'';
|
||
|
};
|
||
|
}
|