{ config, lib, pkgs, ... }: with lib; let cfg = config.services.ctucx.skhd; in { options = { services.ctucx.skhd.enable = mkOption { type = types.bool; default = false; description = lib.mdDoc "Whether to enable the skhd hotkey daemon."; }; services.ctucx.skhd.package = mkOption { type = types.package; default = pkgs.skhd; description = lib.mdDoc "This option specifies the skhd package to use."; }; services.ctucx.skhd.skhdConfig = mkOption { type = types.lines; default = ""; example = "alt + shift - r : chunkc quit"; description = lib.mdDoc "Config to use for {file}`skhdrc`."; }; }; config = mkIf cfg.enable { environment.etc."skhdrc".text = cfg.skhdConfig; launchd.user.agents.skhd = { path = [ config.environment.systemPath ]; serviceConfig.ProgramArguments = [ "/bin/sh" "-c" "/bin/wait4path /nix/store && exec ${cfg.package}/bin/skhd ${optionalString (cfg.skhdConfig != "") "-c /etc/skhdrc"}" ]; serviceConfig.KeepAlive = true; serviceConfig.ProcessType = "Interactive"; }; }; }