home-manager/modules/services/status-notifier-watcher.nix
Nick Hu 4f70f49cec
Add systemd target tray.target (#2027)
This target is for systemd units that require a system tray to be
running.

This also fixes taffybar.service: previously, systemd would consider it
to be active (running) before it was actually ready to accept tray
icons.
2021-05-22 03:15:12 +01:00

46 lines
1.1 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.status-notifier-watcher;
in {
meta.maintainers = [ maintainers.pltanton ];
options = {
services.status-notifier-watcher = {
enable = mkEnableOption "Status Notifier Watcher";
package = mkOption {
default = pkgs.haskellPackages.status-notifier-item;
defaultText =
literalExample "pkgs.haskellPackages.status-notifier-item";
type = types.package;
example = literalExample "pkgs.haskellPackages.status-notifier-item";
description =
"The package to use for the status notifier watcher binary.";
};
};
};
config = mkIf cfg.enable {
systemd.user.services.status-notifier-watcher = {
Unit = {
Description = "SNI watcher";
PartOf = [ "tray.target" ];
Before = [ "taffybar.service" ];
};
Service = {
Type = "dbus";
BusName = "org.kde.StatusNotifierWatcher";
ExecStart = "${cfg.package}/bin/status-notifier-watcher";
};
Install = { WantedBy = [ "tray.target" "taffybar.service" ]; };
};
};
}