2017-01-25 22:50:12 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.khd;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
options = {
|
2017-05-14 14:27:38 +02:00
|
|
|
services.khd.enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable the khd hototkey daemon.";
|
|
|
|
};
|
2017-01-25 22:50:12 +01:00
|
|
|
|
2017-05-14 14:27:38 +02:00
|
|
|
services.khd.package = mkOption {
|
|
|
|
type = types.package;
|
2017-05-20 13:01:25 +02:00
|
|
|
default = pkgs.khd;
|
|
|
|
defaultText = "pkgs.khd";
|
2017-05-14 14:27:38 +02:00
|
|
|
description = "This option specifies the khd package to use.";
|
2017-01-25 22:50:12 +01:00
|
|
|
};
|
2017-05-16 00:32:11 +02:00
|
|
|
|
|
|
|
services.khd.enableAccessibilityAccess = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable accessibility permissions for the khd daemon.";
|
|
|
|
};
|
2017-05-20 13:01:25 +02:00
|
|
|
|
|
|
|
services.khd.khdConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
|
|
|
example = "alt + shift - r : kwmc quit";
|
|
|
|
};
|
2017-01-25 22:50:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
2017-05-16 00:42:41 +02:00
|
|
|
security.accessibilityPrograms = mkIf cfg.enableAccessibilityAccess [ "${cfg.package}/bin/khd" ];
|
2017-05-16 00:32:11 +02:00
|
|
|
|
2017-05-20 13:01:25 +02:00
|
|
|
environment.etc."khdrc".text = cfg.khdConfig;
|
|
|
|
|
2017-01-25 22:50:12 +01:00
|
|
|
launchd.user.agents.khd = {
|
2017-05-14 00:03:49 +02:00
|
|
|
path = [ cfg.package pkgs.kwm config.environment.systemPath ];
|
2017-05-16 00:32:11 +02:00
|
|
|
|
2017-05-20 13:01:25 +02:00
|
|
|
serviceConfig.ProgramArguments = [ "${cfg.package}/bin/khd" "-c" "/etc/khdrc" ];
|
2017-01-25 22:50:12 +01:00
|
|
|
serviceConfig.KeepAlive = true;
|
|
|
|
serviceConfig.ProcessType = "Interactive";
|
|
|
|
serviceConfig.Sockets.Listeners =
|
|
|
|
{ SockServiceName = "3021";
|
|
|
|
SockType = "dgram";
|
|
|
|
SockFamily = "IPv4";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|