feh: add module

This commit is contained in:
Nikita Uvarov 2017-09-04 16:35:23 +02:00
parent 721f924e15
commit ef09f7841b
No known key found for this signature in database
GPG key ID: F7A5FB3A7C10EF96
2 changed files with 42 additions and 0 deletions

View file

@ -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

41
modules/programs/feh.nix Normal file
View file

@ -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 <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)}
'';
};
}