nixos/home/modules/sxhkd.nix

34 lines
797 B
Nix
Raw Permalink Normal View History

2024-09-28 05:21:40 +00:00
{ config, lib, pkgs, ... }:
let
cfg = config.snowhawk.sxhkd;
in
{
options.snowhawk.sxhkd = {
enable = lib.mkEnableOption "custom sxhkd home-manager module";
};
config = lib.mkIf cfg.enable {
systemd.user.services.sxhkd = {
Unit = {
Description = "sxhkd service";
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "exec";
ExecStart = "${pkgs.sxhkd}/bin/sxhkd";
};
Install.WantedBy = [ "graphical-session.target" ];
};
xdg.configFile."sxhkd/sxhkdrc".text =
lib.concatStringsSep "\n" (lib.mapAttrsToList
(hotkey: command:
lib.optionalString (command != null) ''
${hotkey}
${command}
'')
config.services.sxhkd.keybindings);
};
}