2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let cfg = config.services.unclutter-xfixes;
|
|
|
|
|
|
|
|
in {
|
|
|
|
options.services.unclutter-xfixes = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "Enable unclutter-xfixes to hide your mouse cursor when inactive.";
|
2020-04-24 23:36:52 +00:00
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
package = mkPackageOption pkgs "unclutter-xfixes" { };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
timeout = mkOption {
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "Number of seconds before the cursor is marked inactive.";
|
2020-04-24 23:36:52 +00:00
|
|
|
type = types.int;
|
|
|
|
default = 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
threshold = mkOption {
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "Minimum number of pixels considered cursor movement.";
|
2020-04-24 23:36:52 +00:00
|
|
|
type = types.int;
|
|
|
|
default = 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
extraOptions = mkOption {
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "More arguments to pass to the unclutter-xfixes command.";
|
2020-04-24 23:36:52 +00:00
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
example = [ "exclude-root" "ignore-scrolling" "fork" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.user.services.unclutter-xfixes = {
|
|
|
|
description = "unclutter-xfixes";
|
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
partOf = [ "graphical-session.target" ];
|
|
|
|
serviceConfig.ExecStart = ''
|
|
|
|
${cfg.package}/bin/unclutter \
|
|
|
|
--timeout ${toString cfg.timeout} \
|
|
|
|
--jitter ${toString (cfg.threshold - 1)} \
|
|
|
|
${concatMapStrings (x: " --"+x) cfg.extraOptions} \
|
|
|
|
'';
|
|
|
|
serviceConfig.RestartSec = 3;
|
|
|
|
serviceConfig.Restart = "always";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|