1 { config, lib, pkgs, ... }:
5 let cfg = config.services.unclutter-xfixes;
8 options.services.unclutter-xfixes = {
11 description = lib.mdDoc "Enable unclutter-xfixes to hide your mouse cursor when inactive.";
17 description = lib.mdDoc "unclutter-xfixes derivation to use.";
19 default = pkgs.unclutter-xfixes;
20 defaultText = literalExpression "pkgs.unclutter-xfixes";
24 description = lib.mdDoc "Number of seconds before the cursor is marked inactive.";
29 threshold = mkOption {
30 description = lib.mdDoc "Minimum number of pixels considered cursor movement.";
35 extraOptions = mkOption {
36 description = lib.mdDoc "More arguments to pass to the unclutter-xfixes command.";
37 type = types.listOf types.str;
39 example = [ "exclude-root" "ignore-scrolling" "fork" ];
43 config = mkIf cfg.enable {
44 systemd.user.services.unclutter-xfixes = {
45 description = "unclutter-xfixes";
46 wantedBy = [ "graphical-session.target" ];
47 partOf = [ "graphical-session.target" ];
48 serviceConfig.ExecStart = ''
49 ${cfg.package}/bin/unclutter \
50 --timeout ${toString cfg.timeout} \
51 --jitter ${toString (cfg.threshold - 1)} \
52 ${concatMapStrings (x: " --"+x) cfg.extraOptions} \
54 serviceConfig.RestartSec = 3;
55 serviceConfig.Restart = "always";