aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/misc/numlock.nix
blob: 199dd317daa3925b3ecee6e126b10e9280020354 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.xsession.numlock;

in {
  options = { xsession.numlock.enable = mkEnableOption "Num Lock"; };

  config = mkIf cfg.enable {
    systemd.user.services.numlockx = {
      Unit = {
        Description = "NumLockX";
        After = [ "graphical-session-pre.target" ];
        PartOf = [ "graphical-session.target" ];
      };

      Service = {
        Type = "oneshot";
        RemainAfterExit = true;
        ExecStart = "${pkgs.numlockx}/bin/numlockx";
      };

      Install = { WantedBy = [ "graphical-session.target" ]; };
    };
  };
}