1 { config, lib, pkgs, ... }:
5 let cfg = config.services.unclutter;
8 options.services.unclutter = {
11 description = lib.mdDoc "Enable unclutter to hide your mouse cursor when inactive";
18 default = pkgs.unclutter;
19 defaultText = literalExpression "pkgs.unclutter";
20 description = lib.mdDoc "unclutter derivation to use.";
23 keystroke = mkOption {
24 description = lib.mdDoc "Wait for a keystroke before hiding the cursor";
30 description = lib.mdDoc "Number of seconds before the cursor is marked inactive";
35 threshold = mkOption {
36 description = lib.mdDoc "Minimum number of pixels considered cursor movement";
42 description = lib.mdDoc "Names of windows where unclutter should not apply";
43 type = types.listOf types.str;
48 extraOptions = mkOption {
49 description = lib.mdDoc "More arguments to pass to the unclutter command";
50 type = types.listOf types.str;
52 example = [ "noevent" "grab" ];
56 config = mkIf cfg.enable {
57 systemd.user.services.unclutter = {
58 description = "unclutter";
59 wantedBy = [ "graphical-session.target" ];
60 partOf = [ "graphical-session.target" ];
61 serviceConfig.ExecStart = ''
62 ${cfg.package}/bin/unclutter \
63 -idle ${toString cfg.timeout} \
64 -jitter ${toString (cfg.threshold - 1)} \
65 ${optionalString cfg.keystroke "-keystroke"} \
66 ${concatMapStrings (x: " -"+x) cfg.extraOptions} \
67 -not ${concatStringsSep " " cfg.excluded} \
69 serviceConfig.PassEnvironment = "DISPLAY";
70 serviceConfig.RestartSec = 3;
71 serviceConfig.Restart = "always";
76 (mkRenamedOptionModule [ "services" "unclutter" "threeshold" ]
77 [ "services" "unclutter" "threshold" ])
80 meta.maintainers = with lib.maintainers; [ rnhmjoj ];