This commit is contained in:
2026-01-18 23:17:17 +08:00
parent cc988bba6f
commit fd3f507e8c
11 changed files with 103 additions and 454 deletions
+5 -43
View File
@@ -1,54 +1,16 @@
# skhd (Simple Hotkey Daemon) configuration for macOS
# Uses home-manager's launchd.agents for service management
# Uses upstream home-manager's services.skhd module
{
config,
lib,
pkgs,
...
}: let
cfg = config.services.skhd;
super = "lalt";
in {
options.services.skhd = {
enable = lib.mkEnableOption "skhd hotkey daemon";
package = lib.mkPackageOption pkgs "skhd" {};
config = lib.mkOption {
type = with lib.types; nullOr lines;
default = null;
description = "Contents of skhdrc configuration file.";
};
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = pkgs.stdenv.isDarwin;
message = "services.skhd is only available on macOS";
}
];
home.packages = [cfg.package];
launchd.agents.skhd = {
enable = true;
config = {
ProgramArguments = ["${cfg.package}/bin/skhd"];
ProcessType = "Interactive";
KeepAlive = true;
RunAtLoad = true;
StandardErrorPath = "${config.home.homeDirectory}/Library/Logs/skhd/skhd.err.log";
StandardOutPath = "${config.home.homeDirectory}/Library/Logs/skhd/skhd.out.log";
};
};
xdg.configFile."skhd/skhdrc" = lib.mkIf (cfg.config != null) {
text = cfg.config;
};
# Default skhd configuration for yabai integration
services.skhd.config = lib.mkDefault ''
in lib.mkIf pkgs.stdenv.isDarwin {
services.skhd = {
enable = true;
config = ''
## Navigation (${super} - ...)
# Space Navigation (four spaces per display): ${super} - {1, 2, 3, 4}
${super} - 1 : yabai -m space --focus 1