aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Uvarov <uv.nikita@gmail.com>2017-09-04 16:35:23 +0200
committerRobert Helgesson <robert@rycee.net>2017-09-04 21:36:06 +0200
commitf5289c546e82507537b42f7b26eba2731966cb60 (patch)
treeb509fa1792a5e586d816e33a3ea58b339dcf4e64
parent721f924e151d5c2195ac55c5af39485023cb7b94 (diff)
feh: add module
-rw-r--r--modules/default.nix1
-rw-r--r--modules/programs/feh.nix41
2 files changed, 42 insertions, 0 deletions
diff --git a/modules/default.nix b/modules/default.nix
index f180423bd08..a6dc6848fcd 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 00000000000..1ca83ca8121
--- /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 <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)}
+ '';
+ };
+}