aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/services/unclutter.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/modules/services/unclutter.nix')
-rw-r--r--home-manager/modules/services/unclutter.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/home-manager/modules/services/unclutter.nix b/home-manager/modules/services/unclutter.nix
new file mode 100644
index 00000000000..6b5ac866ec5
--- /dev/null
+++ b/home-manager/modules/services/unclutter.nix
@@ -0,0 +1,63 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let cfg = config.services.unclutter;
+
+in {
+ options.services.unclutter = {
+
+ enable = mkEnableOption "unclutter";
+
+ package = mkOption {
+ description = "unclutter derivation to use.";
+ type = types.package;
+ default = pkgs.unclutter-xfixes;
+ defaultText = literalExample "pkgs.unclutter-xfixes";
+ };
+
+ timeout = mkOption {
+ description = "Number of seconds before the cursor is marked inactive.";
+ type = types.int;
+ default = 1;
+ };
+
+ threshold = mkOption {
+ description = "Minimum number of pixels considered cursor movement.";
+ type = types.int;
+ default = 1;
+ };
+
+ extraOptions = mkOption {
+ description = "More arguments to pass to the unclutter command.";
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "exclude-root" "ignore-scrolling" ];
+ };
+ };
+
+ config = mkIf cfg.enable {
+ systemd.user.services.unclutter = {
+ Unit = {
+ Description = "unclutter";
+ After = [ "graphical-session-pre.target" ];
+ PartOf = [ "graphical-session.target" ];
+ };
+
+ Service = {
+ ExecStart = ''
+ ${cfg.package}/bin/unclutter \
+ --timeout ${toString cfg.timeout} \
+ --jitter ${toString (cfg.threshold - 1)} \
+ ${concatMapStrings (x: " --${x}") cfg.extraOptions}
+ '';
+ RestartSec = 3;
+ Restart = "always";
+ };
+
+ Install = {
+ WantedBy = [ "graphical-session.target" ];
+ };
+ };
+ };
+}