Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/services/sxhkd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ in {
};

keybindings = mkOption {
type = types.attrsOf (types.nullOr types.str);
type =
types.attrsOf (types.nullOr (types.oneOf [ types.str types.path ]));
default = { };
description = "An attribute set that assigns hotkeys to commands.";
example = literalExpression ''
{
"super + shift + {r,c}" = "i3-msg {restart,reload}";
"super + {s,w}" = "i3-msg {stacking,tabbed}";
"super + F1" = pkgs.writeShellScript "script" "echo $USER";
}
'';
};
Expand Down
14 changes: 12 additions & 2 deletions tests/modules/services/sxhkd/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{ config, pkgs, ... }:

{
let
script = pkgs.writeShellScript "script.sh" ''
echo "test"
'';
in {
services.sxhkd = {
enable = true;

Expand All @@ -10,6 +14,7 @@
"super + a" = "run command a";
"super + b" = null;
"super + Shift + b" = "run command b";
"super + s" = script;
};

extraConfig = ''
Expand All @@ -27,6 +32,11 @@

assertFileExists $sxhkdrc

assertFileContent $sxhkdrc ${./sxhkdrc}
assertFileContent $sxhkdrc ${
pkgs.substituteAll {
src = ./sxhkdrc;
inherit script;
}
}
'';
}
3 changes: 3 additions & 0 deletions tests/modules/services/sxhkd/sxhkdrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ super + a
run command a


super + s
@script@

super + c
call command c

Expand Down