summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2018-03-05 21:10:36 +0100
committerGitHub <noreply@github.com>2018-03-05 21:10:36 +0100
commit005ccb6987fe63fa5b273bd60ce002812136797d (patch)
tree84f72e970b9bd1e232a2dc1105993ac8203ac7a4 /modules
parentc232436db50b8a9eb53d585057c484bae39a5bdc (diff)
parent81018ab64daaebf04c3210bd27ae080ef4aa665a (diff)
Merge pull request #73 from peel/master
adds skhd module
Diffstat (limited to 'modules')
-rw-r--r--modules/services/skhd/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/modules/services/skhd/default.nix b/modules/services/skhd/default.nix
new file mode 100644
index 0000000..093fdd3
--- /dev/null
+++ b/modules/services/skhd/default.nix
@@ -0,0 +1,47 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.skhd;
+
+in {
+
+ options = {
+ services.skhd.enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the skhd hotkey daemon.";
+ };
+
+ services.skhd.package = mkOption {
+ type = types.package;
+ example = literalExample "pkgs.skhd";
+ description = "This option specifies the skhd package to use.";
+ };
+
+ services.skhd.skhdConfig = mkOption {
+ type = types.lines;
+ default = "";
+ example = "alt + shift - r : chunkc quit";
+ description = "Config to use for <filename>skhdrc</filename>.";
+ };
+ };
+
+ config = mkIf cfg.enable {
+
+ environment.etc."skhdrc".text = cfg.skhdConfig;
+
+ launchd.user.agents.skhd = {
+ path = [ cfg.package config.environment.systemPath ];
+
+ serviceConfig.ProgramArguments = [ "${cfg.package}/bin/skhd" ]
+ ++ optionals (cfg.skhdConfig != "") [ "-c" "/etc/skhdrc" ];
+ serviceConfig.KeepAlive = true;
+ serviceConfig.ProcessType = "Interactive";
+ serviceConfig.StandardOutPath = "/tmp/skhd.out";
+ serviceConfig.StandardErrorPath = "/tmp/skhd.err";
+ };
+
+ };
+}