feh: add module
This commit is contained in:
parent
721f924e15
commit
f5289c546e
|
@ -17,6 +17,7 @@ let
|
||||||
./programs/browserpass.nix
|
./programs/browserpass.nix
|
||||||
./programs/eclipse.nix
|
./programs/eclipse.nix
|
||||||
./programs/emacs.nix
|
./programs/emacs.nix
|
||||||
|
./programs/feh.nix
|
||||||
./programs/firefox.nix
|
./programs/firefox.nix
|
||||||
./programs/git.nix
|
./programs/git.nix
|
||||||
./programs/gnome-terminal.nix
|
./programs/gnome-terminal.nix
|
||||||
|
|
41
modules/programs/feh.nix
Normal file
41
modules/programs/feh.nix
Normal 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)}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue