blob: 7594baffe5b964b0d42f29484398f557dc4f9f43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.khd;
i3Config = import ./i3.nix { inherit pkgs; };
in
{
options = {
services.khd.enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the khd hotkey daemon.";
};
services.khd.package = mkOption {
type = types.package;
default = pkgs.khd;
defaultText = "pkgs.khd";
description = "This option specifies the khd package to use.";
};
services.khd.khdConfig = mkOption {
type = types.lines;
default = "";
example = "alt + shift - r : kwmc quit";
description = "Config to use for {file}`khdrc`.";
};
services.khd.i3Keybindings = mkOption {
type = types.bool;
default = false;
description = "Wether to configure i3 style keybindings for kwm.";
};
};
config = mkIf cfg.enable {
services.khd.khdConfig = mkIf cfg.i3Keybindings i3Config;
security.accessibilityPrograms = [ "${cfg.package}/bin/khd" ];
environment.etc."khdrc".text = cfg.khdConfig;
launchd.user.agents.khd = {
path = [ cfg.package config.environment.systemPath ];
serviceConfig.ProgramArguments = [ "${cfg.package}/bin/khd" ]
++ optionals (cfg.khdConfig != "") [ "-c" "/etc/khdrc" ];
serviceConfig.KeepAlive = true;
serviceConfig.ProcessType = "Interactive";
serviceConfig.Sockets.Listeners =
{ SockServiceName = "3021";
SockType = "dgram";
SockFamily = "IPv4";
};
};
};
}
|