at 24.11-pre 1.5 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let cfg = config.services.unclutter-xfixes; 6 7in { 8 options.services.unclutter-xfixes = { 9 10 enable = mkOption { 11 description = "Enable unclutter-xfixes to hide your mouse cursor when inactive."; 12 type = types.bool; 13 default = false; 14 }; 15 16 package = mkPackageOption pkgs "unclutter-xfixes" { }; 17 18 timeout = mkOption { 19 description = "Number of seconds before the cursor is marked inactive."; 20 type = types.int; 21 default = 1; 22 }; 23 24 threshold = mkOption { 25 description = "Minimum number of pixels considered cursor movement."; 26 type = types.int; 27 default = 1; 28 }; 29 30 extraOptions = mkOption { 31 description = "More arguments to pass to the unclutter-xfixes command."; 32 type = types.listOf types.str; 33 default = []; 34 example = [ "exclude-root" "ignore-scrolling" "fork" ]; 35 }; 36 }; 37 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} \ 48 ''; 49 serviceConfig.RestartSec = 3; 50 serviceConfig.Restart = "always"; 51 }; 52 }; 53}