1 { config, lib, pkgs, ... }:
5 let cfg = config.services.unclutter-xfixes;
8 options.services.unclutter-xfixes = {
11 description = "Enable unclutter-xfixes to hide your mouse cursor when inactive.";
16 package = mkPackageOption pkgs "unclutter-xfixes" { };
19 description = "Number of seconds before the cursor is marked inactive.";
24 threshold = mkOption {
25 description = "Minimum number of pixels considered cursor movement.";
30 extraOptions = mkOption {
31 description = "More arguments to pass to the unclutter-xfixes command.";
32 type = types.listOf types.str;
34 example = [ "exclude-root" "ignore-scrolling" "fork" ];
38 config = mkIf cfg.enable {
39 systemd.user.services.unclutter-xfixes = {
40 description = "unclutter-xfixes";
41 wantedBy = [ "graphical-session.target" ];
42 partOf = [ "graphical-session.target" ];
43 serviceConfig.ExecStart = ''
44 ${cfg.package}/bin/unclutter \
45 --timeout ${toString cfg.timeout} \
46 --jitter ${toString (cfg.threshold - 1)} \
47 ${concatMapStrings (x: " --"+x) cfg.extraOptions} \
49 serviceConfig.RestartSec = 3;
50 serviceConfig.Restart = "always";