diff --git a/modules/default.nix b/modules/default.nix index f180423bd..a6dc6848f 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -17,6 +17,7 @@ let ./programs/browserpass.nix ./programs/eclipse.nix ./programs/emacs.nix + ./programs/feh.nix ./programs/firefox.nix ./programs/git.nix ./programs/gnome-terminal.nix diff --git a/modules/programs/feh.nix b/modules/programs/feh.nix new file mode 100644 index 000000000..1ca83ca81 --- /dev/null +++ b/modules/programs/feh.nix @@ -0,0 +1,41 @@ +{ 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 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)} + ''; + }; +}