1 { config, lib, pkgs, ... }:
5 let cfg = config.services.unclutter;
8 options.services.unclutter = {
11 description = "Enable unclutter to hide your mouse cursor when inactive";
16 package = mkPackageOption pkgs "unclutter" { };
18 keystroke = mkOption {
19 description = "Wait for a keystroke before hiding the cursor";
25 description = "Number of seconds before the cursor is marked inactive";
30 threshold = mkOption {
31 description = "Minimum number of pixels considered cursor movement";
37 description = "Names of windows where unclutter should not apply";
38 type = types.listOf types.str;
43 extraOptions = mkOption {
44 description = "More arguments to pass to the unclutter command";
45 type = types.listOf types.str;
47 example = [ "noevent" "grab" ];
51 config = mkIf cfg.enable {
52 systemd.user.services.unclutter = {
53 description = "unclutter";
54 wantedBy = [ "graphical-session.target" ];
55 partOf = [ "graphical-session.target" ];
56 serviceConfig.ExecStart = ''
57 ${cfg.package}/bin/unclutter \
58 -idle ${toString cfg.timeout} \
59 -jitter ${toString (cfg.threshold - 1)} \
60 ${optionalString cfg.keystroke "-keystroke"} \
61 ${concatMapStrings (x: " -"+x) cfg.extraOptions} \
62 -not ${concatStringsSep " " cfg.excluded} \
64 serviceConfig.PassEnvironment = "DISPLAY";
65 serviceConfig.RestartSec = 3;
66 serviceConfig.Restart = "always";
71 (mkRenamedOptionModule [ "services" "unclutter" "threeshold" ]
72 [ "services" "unclutter" "threshold" ])
75 meta.maintainers = with lib.maintainers; [ rnhmjoj ];