at master 1.5 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7 8with lib; 9 10let 11 cfg = config.services.unclutter-xfixes; 12 13in 14{ 15 options.services.unclutter-xfixes = { 16 17 enable = mkOption { 18 description = "Enable unclutter-xfixes to hide your mouse cursor when inactive."; 19 type = types.bool; 20 default = false; 21 }; 22 23 package = mkPackageOption pkgs "unclutter-xfixes" { }; 24 25 timeout = mkOption { 26 description = "Number of seconds before the cursor is marked inactive."; 27 type = types.int; 28 default = 1; 29 }; 30 31 threshold = mkOption { 32 description = "Minimum number of pixels considered cursor movement."; 33 type = types.int; 34 default = 1; 35 }; 36 37 extraOptions = mkOption { 38 description = "More arguments to pass to the unclutter-xfixes command."; 39 type = types.listOf types.str; 40 default = [ ]; 41 example = [ 42 "exclude-root" 43 "ignore-scrolling" 44 "fork" 45 ]; 46 }; 47 }; 48 49 config = mkIf cfg.enable { 50 systemd.user.services.unclutter-xfixes = { 51 description = "unclutter-xfixes"; 52 wantedBy = [ "graphical-session.target" ]; 53 partOf = [ "graphical-session.target" ]; 54 serviceConfig.ExecStart = '' 55 ${cfg.package}/bin/unclutter \ 56 --timeout ${toString cfg.timeout} \ 57 --jitter ${toString (cfg.threshold - 1)} \ 58 ${concatMapStrings (x: " --" + x) cfg.extraOptions} \ 59 ''; 60 serviceConfig.RestartSec = 3; 61 serviceConfig.Restart = "always"; 62 }; 63 }; 64}