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

feh: add module

This commit is contained in:
Nikita Uvarov 2017-09-04 16:35:23 +02:00 committed by Robert Helgesson
parent 721f924e15
commit f5289c546e
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86
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)}
'';
};
}