1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-23 18:29:47 +01:00

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.
This commit is contained in:
Nick Hu 2021-05-22 03:15:12 +01:00 committed by GitHub
parent 82ab1ad467
commit 4f70f49cec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 48 additions and 45 deletions

View file

@ -24,7 +24,8 @@ with lib;
systemd.user.services.blueman-applet = { systemd.user.services.blueman-applet = {
Unit = { Unit = {
Description = "Blueman applet"; Description = "Blueman applet";
After = [ "graphical-session-pre.target" ]; Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };

View file

@ -103,7 +103,8 @@ in {
systemd.user.services.cbatticon = { systemd.user.services.cbatticon = {
Unit = { Unit = {
Description = "cbatticon system tray battery icon"; Description = "cbatticon system tray battery icon";
After = [ "graphical-session-pre.target" ]; Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };

View file

@ -18,12 +18,8 @@ in {
systemd.user.services.flameshot = { systemd.user.services.flameshot = {
Unit = { Unit = {
Description = "Flameshot screenshot tool"; Description = "Flameshot screenshot tool";
After = [ Requires = [ "tray.target" ];
"graphical-session-pre.target" After = [ "graphical-session-pre.target" "tray.target" ];
"polybar.service"
"stalonetray.service"
"taffybar.service"
];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };

View file

@ -19,7 +19,8 @@ in {
systemd.user.services.network-manager-applet = { systemd.user.services.network-manager-applet = {
Unit = { Unit = {
Description = "Network Manager applet"; Description = "Network Manager applet";
After = [ "graphical-session-pre.target" ]; Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };

View file

@ -27,7 +27,8 @@ in {
systemd.user.services.parcellite = { systemd.user.services.parcellite = {
Unit = { Unit = {
Description = "Lightweight GTK+ clipboard manager"; Description = "Lightweight GTK+ clipboard manager";
After = [ "graphical-session-pre.target" ]; Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };

View file

@ -13,7 +13,8 @@ with lib;
systemd.user.services.pasystray = { systemd.user.services.pasystray = {
Unit = { Unit = {
Description = "PulseAudio system tray"; Description = "PulseAudio system tray";
After = [ "graphical-session-pre.target" ]; Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };

View file

@ -197,8 +197,7 @@ in {
systemd.user.services.polybar = { systemd.user.services.polybar = {
Unit = { Unit = {
Description = "Polybar status bar"; Description = "Polybar status bar";
After = [ "graphical-session-pre.target" ]; PartOf = [ "tray.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers = X-Restart-Triggers =
[ "${config.xdg.configFile."polybar/config".source}" ]; [ "${config.xdg.configFile."polybar/config".source}" ];
}; };
@ -212,7 +211,7 @@ in {
Restart = "on-failure"; Restart = "on-failure";
}; };
Install = { WantedBy = [ "graphical-session.target" ]; }; Install = { WantedBy = [ "tray.target" ]; };
}; };
}; };

View file

@ -56,11 +56,10 @@ in {
systemd.user.services.stalonetray = { systemd.user.services.stalonetray = {
Unit = { Unit = {
Description = "Stalonetray system tray"; Description = "Stalonetray system tray";
After = [ "graphical-session-pre.target" ]; PartOf = [ "tray.target" ];
PartOf = [ "graphical-session.target" ];
}; };
Install = { WantedBy = [ "graphical-session.target" ]; }; Install = { WantedBy = [ "tray.target" ]; };
Service = { Service = {
ExecStart = "${cfg.package}/bin/stalonetray"; ExecStart = "${cfg.package}/bin/stalonetray";

View file

@ -29,16 +29,17 @@ in {
systemd.user.services.status-notifier-watcher = { systemd.user.services.status-notifier-watcher = {
Unit = { Unit = {
Description = "SNI watcher"; Description = "SNI watcher";
After = [ "graphical-session-pre.target" ]; PartOf = [ "tray.target" ];
PartOf = [ "graphical-session.target" ];
Before = [ "taffybar.service" ]; Before = [ "taffybar.service" ];
}; };
Service = { ExecStart = "${cfg.package}/bin/status-notifier-watcher"; }; Service = {
Type = "dbus";
Install = { BusName = "org.kde.StatusNotifierWatcher";
WantedBy = [ "graphical-session.target" "taffybar.service" ]; ExecStart = "${cfg.package}/bin/status-notifier-watcher";
}; };
Install = { WantedBy = [ "tray.target" "taffybar.service" ]; };
}; };
}; };
} }

View file

@ -74,12 +74,8 @@ with lib;
${config.services.syncthing.tray.package.pname} = { ${config.services.syncthing.tray.package.pname} = {
Unit = { Unit = {
Description = config.services.syncthing.tray.package.pname; Description = config.services.syncthing.tray.package.pname;
After = [ Requires = [ "tray.target" ];
"graphical-session-pre.target" After = [ "graphical-session-pre.target" "tray.target" ];
"polybar.service"
"taffybar.service"
"stalonetray.service"
];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };
@ -100,12 +96,8 @@ with lib;
"syncthingtray" = { "syncthingtray" = {
Unit = { Unit = {
Description = "syncthingtray"; Description = "syncthingtray";
After = [ Requires = [ "tray.target" ];
"graphical-session-pre.target" After = [ "graphical-session-pre.target" "tray.target" ];
"polybar.service"
"taffybar.service"
"stalonetray.service"
];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };

View file

@ -27,16 +27,17 @@ in {
systemd.user.services.taffybar = { systemd.user.services.taffybar = {
Unit = { Unit = {
Description = "Taffybar desktop bar"; Description = "Taffybar desktop bar";
After = [ "graphical-session-pre.target" ]; PartOf = [ "tray.target" ];
PartOf = [ "graphical-session.target" ];
}; };
Service = { Service = {
Type = "dbus";
BusName = "org.taffybar.Bar";
ExecStart = "${cfg.package}/bin/taffybar"; ExecStart = "${cfg.package}/bin/taffybar";
Restart = "on-failure"; Restart = "on-failure";
}; };
Install = { WantedBy = [ "graphical-session.target" ]; }; Install = { WantedBy = [ "tray.target" ]; };
}; };
xsession.importedVariables = [ "GDK_PIXBUF_MODULE_FILE" ]; xsession.importedVariables = [ "GDK_PIXBUF_MODULE_FILE" ];

View file

@ -77,7 +77,8 @@ in {
systemd.user.services.udiskie = { systemd.user.services.udiskie = {
Unit = { Unit = {
Description = "udiskie mount daemon"; Description = "udiskie mount daemon";
After = [ "graphical-session-pre.target" ]; Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };

View file

@ -110,12 +110,21 @@ in {
}; };
}; };
# A basic graphical session target for Home Manager. targets = {
targets.hm-graphical-session = { # A basic graphical session target for Home Manager.
Unit = { hm-graphical-session = {
Description = "Home Manager X session"; Unit = {
Requires = [ "graphical-session-pre.target" ]; Description = "Home Manager X session";
BindsTo = [ "graphical-session.target" ]; Requires = [ "graphical-session-pre.target" ];
BindsTo = [ "graphical-session.target" "tray.target" ];
};
};
tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = [ "graphical-session-pre.target" ];
};
}; };
}; };
}; };