1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-20 10:09:45 +01:00

sxhkd: allow usage of derivations as keybind commands (#4169)

This makes it consistent with some other options, like
`systemd.user.services.Service.ExecStart`.
This commit is contained in:
Kylie McClain 2023-06-30 19:49:05 -04:00 committed by GitHub
parent 0f71012724
commit 44d1a8542a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 3 deletions

View file

@ -38,13 +38,15 @@ in {
}; };
keybindings = mkOption { keybindings = mkOption {
type = types.attrsOf (types.nullOr types.str); type =
types.attrsOf (types.nullOr (types.oneOf [ types.str types.path ]));
default = { }; default = { };
description = "An attribute set that assigns hotkeys to commands."; description = "An attribute set that assigns hotkeys to commands.";
example = literalExpression '' example = literalExpression ''
{ {
"super + shift + {r,c}" = "i3-msg {restart,reload}"; "super + shift + {r,c}" = "i3-msg {restart,reload}";
"super + {s,w}" = "i3-msg {stacking,tabbed}"; "super + {s,w}" = "i3-msg {stacking,tabbed}";
"super + F1" = pkgs.writeShellScript "script" "echo $USER";
} }
''; '';
}; };

View file

@ -1,6 +1,10 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ let
script = pkgs.writeShellScript "script.sh" ''
echo "test"
'';
in {
services.sxhkd = { services.sxhkd = {
enable = true; enable = true;
@ -10,6 +14,7 @@
"super + a" = "run command a"; "super + a" = "run command a";
"super + b" = null; "super + b" = null;
"super + Shift + b" = "run command b"; "super + Shift + b" = "run command b";
"super + s" = script;
}; };
extraConfig = '' extraConfig = ''
@ -27,6 +32,11 @@
assertFileExists $sxhkdrc assertFileExists $sxhkdrc
assertFileContent $sxhkdrc ${./sxhkdrc} assertFileContent $sxhkdrc ${
pkgs.substituteAll {
src = ./sxhkdrc;
inherit script;
}
}
''; '';
} }

View file

@ -5,6 +5,9 @@ super + a
run command a run command a
super + s
@script@
super + c super + c
call command c call command c