summary refs log tree commit diff
path: root/nixos/modules/services/x11/unclutter.nix
blob: 6e8719e1053fb9c3459df80db5fc6cb047ab6e93 (plain) (blame)
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
30
31
32
33
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.unclutter;
in {
  options = {
    services.unclutter.enable = mkOption {
      type = types.bool;
      default = false;
      example = true;
      description = "Enable unclutter to hide your mouse cursor when inactive";
    };

    services.unclutter.arguments = mkOption {
      description = "Arguments to pass to unclutter command";
      default = "-idle 1";
      type = types.str;
    };
  };

  config = mkIf cfg.enable {
    systemd.services.unclutter = {
      description = "unclutter";
      requires = [ "display-manager.service" ];
      after = [ "display-manager.service" ];
      wantedBy = [ "graphical.target" ];
      serviceConfig.ExecStart = ''
        ${pkgs.unclutter}/bin/unclutter ${cfg.arguments}
      '';
      environment = { DISPLAY = ":0"; };
      serviceConfig.Restart = "always";
    };
  };
}