summaryrefslogtreecommitdiff
path: root/modules/services/khd.nix
blob: f308736173ee34f2de421641d65d629c33655c5a (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
{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.services.khd;

in

{
  options = {
    services.khd = {

      enable = mkOption {
        type = types.bool;
        default = false;
        description = "Whether to enable the khd hototkey daemon.";
      };

      package = mkOption {
        type = types.path;
        default = pkgs.khd;
        defaultText = "pkgs.khd";
        description = "This option specifies the khd package to use.";
      };

    };
  };

  config = mkIf cfg.enable {

    launchd.user.agents.khd = {
      path = [ cfg.package pkgs.kwm config.environment.systemPath ];
      serviceConfig.Program = "${cfg.package}/bin/khd";
      serviceConfig.KeepAlive = true;
      serviceConfig.ProcessType = "Interactive";
      serviceConfig.Sockets.Listeners =
        { SockServiceName = "3021";
          SockType = "dgram";
          SockFamily = "IPv4";
        };
    };

  };
}