diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index c41ae69c1ac..9335b6d24f3 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -352,6 +352,7 @@ ./services/web-servers/varnish/default.nix ./services/web-servers/winstone.nix ./services/web-servers/zope2.nix + ./services/x11/unclutter.nix ./services/x11/desktop-managers/default.nix ./services/x11/display-managers/auto.nix ./services/x11/display-managers/default.nix diff --git a/nixos/modules/services/x11/unclutter.nix b/nixos/modules/services/x11/unclutter.nix new file mode 100644 index 00000000000..556d9e187fd --- /dev/null +++ b/nixos/modules/services/x11/unclutter.nix @@ -0,0 +1,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.uniq types.string; + }; + }; + + 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"; + }; + }; +}