feh: allow binding actions to multiple buttons/keys
In feh you can bind multiple keys to the same action, but Home Manager only let you set a single key to an action. You can cheat and pass a string with space-separated keys, but with this change you can pass a list for each action to bind multiple keys to it. Also adds a couple of tests. Fixes #1366
This commit is contained in:
parent
6fed10a09a
commit
41147ae09a
7 changed files with 89 additions and 18 deletions
4
tests/modules/programs/feh/default.nix
Normal file
4
tests/modules/programs/feh/default.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
feh-empty-config = ./feh-empty-settings.nix;
|
||||
feh-bindings = ./feh-bindings.nix;
|
||||
}
|
||||
4
tests/modules/programs/feh/feh-bindings-expected-buttons
Normal file
4
tests/modules/programs/feh/feh-bindings-expected-buttons
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
zoom_in
|
||||
next_img C-4
|
||||
prev_img 3 C-3
|
||||
zoom_out 4
|
||||
3
tests/modules/programs/feh/feh-bindings-expected-keys
Normal file
3
tests/modules/programs/feh/feh-bindings-expected-keys
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
zoom_in
|
||||
prev_img h Left
|
||||
zoom_out minus
|
||||
33
tests/modules/programs/feh/feh-bindings.nix
Normal file
33
tests/modules/programs/feh/feh-bindings.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.feh.enable = true;
|
||||
|
||||
programs.feh.buttons = {
|
||||
zoom_in = null;
|
||||
zoom_out = 4;
|
||||
next_img = "C-4";
|
||||
prev_img = [ 3 "C-3" ];
|
||||
};
|
||||
|
||||
programs.feh.keybindings = {
|
||||
zoom_in = null;
|
||||
zoom_out = "minus";
|
||||
prev_img = [ "h" "Left" ];
|
||||
};
|
||||
|
||||
nixpkgs.overlays =
|
||||
[ (self: super: { feh = pkgs.writeScriptBin "dummy-feh" ""; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/feh/buttons \
|
||||
${./feh-bindings-expected-buttons}
|
||||
|
||||
assertFileContent \
|
||||
home-files/.config/feh/keys \
|
||||
${./feh-bindings-expected-keys}
|
||||
'';
|
||||
};
|
||||
}
|
||||
15
tests/modules/programs/feh/feh-empty-settings.nix
Normal file
15
tests/modules/programs/feh/feh-empty-settings.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.feh.enable = true;
|
||||
|
||||
nixpkgs.overlays =
|
||||
[ (self: super: { feh = pkgs.writeScriptBin "dummy-feh" ""; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/feh/buttons
|
||||
assertPathNotExists home-files/.config/feh/keys
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue