Skip to content

Commit

Permalink
services/skhd: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Dec 18, 2024
1 parent a35b08d commit f781cd5
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions modules/services/skhd/default.nix
Original file line number Diff line number Diff line change
@@ -1,46 +1,55 @@
{ config, lib, pkgs, ... }:

with lib;

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.skhd;
in

inherit (lib) mkOption types;
in
{
options = {
services.skhd.enable = mkOption {
options.services.skhd = {
enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the skhd hotkey daemon.";
};

services.skhd.package = mkOption {
package = mkOption {
type = types.package;
default = pkgs.skhd;
description = "This option specifies the skhd package to use.";
};

services.skhd.skhdConfig = mkOption {
skhdConfig = mkOption {
type = types.lines;
default = "";
example = "alt + shift - r : chunkc quit";
description = "Config to use for {file}`skhdrc`.";
};
};

config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];

environment.etc."skhdrc".text = cfg.skhdConfig;
config = lib.mkIf cfg.enable {
environment = {
systemPackages = [ cfg.package ];
etc."skhdrc".text = cfg.skhdConfig;
};

launchd.user.agents.skhd = {
path = [ config.environment.systemPath ];

serviceConfig.ProgramArguments = [ "${cfg.package}/bin/skhd" ]
++ optionals (cfg.skhdConfig != "") [ "-c" "/etc/skhdrc" ];
serviceConfig.KeepAlive = true;
serviceConfig.ProcessType = "Interactive";
serviceConfig = {
ProgramArguments =
[ "${cfg.package}/bin/skhd" ]
++ lib.optionals (cfg.skhdConfig != "") [
"-c"
"/etc/skhdrc"
];
KeepAlive = true;
ProcessType = "Interactive";
};
};

};
}

0 comments on commit f781cd5

Please sign in to comment.