2020-10-12 00:22:58 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2024-01-05 11:06:15 +00:00
|
|
|
let cfg = config.services.pasystray;
|
|
|
|
|
|
|
|
in {
|
2023-01-10 09:35:00 +00:00
|
|
|
meta.maintainers = [ hm.maintainers.pltanton ];
|
2020-10-12 00:22:58 +00:00
|
|
|
|
|
|
|
options = {
|
2024-01-05 11:06:15 +00:00
|
|
|
services.pasystray = {
|
|
|
|
enable = mkEnableOption "PulseAudio system tray";
|
|
|
|
|
|
|
|
extraOptions = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ ];
|
|
|
|
description = ''
|
|
|
|
Extra command-line arguments to pass to {command}`pasystray`.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2020-10-12 00:22:58 +00:00
|
|
|
};
|
|
|
|
|
2024-01-05 11:06:15 +00:00
|
|
|
config = mkIf cfg.enable {
|
2023-08-08 10:19:01 +00:00
|
|
|
assertions = [
|
|
|
|
(hm.assertions.assertPlatform "services.pasystray" pkgs platforms.linux)
|
|
|
|
];
|
|
|
|
|
2020-10-12 00:22:58 +00:00
|
|
|
systemd.user.services.pasystray = {
|
|
|
|
Unit = {
|
|
|
|
Description = "PulseAudio system tray";
|
2021-07-02 22:36:30 +00:00
|
|
|
Requires = [ "tray.target" ];
|
|
|
|
After = [ "graphical-session-pre.target" "tray.target" ];
|
2020-10-12 00:22:58 +00:00
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
Environment =
|
|
|
|
let toolPaths = makeBinPath [ pkgs.paprefs pkgs.pavucontrol ];
|
|
|
|
in [ "PATH=${toolPaths}" ];
|
2024-01-05 11:06:15 +00:00
|
|
|
ExecStart = escapeShellArgs
|
|
|
|
([ "${pkgs.pasystray}/bin/pasystray" ] ++ cfg.extraOptions);
|
2020-10-12 00:22:58 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|