Skip to content

Commit

Permalink
treewide: use graphical-session.target for GUI services
Browse files Browse the repository at this point in the history
As per systemd.special(7)[0] graphical-session-pre.target is strictly
for units that set up things for a graphical session. Most notably,
these are usually started *before* the compositor/session is actually
ready.

While Home Manager's current implementation of graphical-session.target
allows these units to work regardless of what systemd.special(7)
specifies, other setups like ones with uwsm[1] do not allow these units
to start properly.

[0]: https://www.freedesktop.org/software/systemd/man/latest/systemd.special.html#graphical-session-pre.target
[1]: https://github.com/Vladimir-csp/uwsm

Signed-off-by: Sefa Eyeoglu <[email protected]>
  • Loading branch information
Scrumplex committed Oct 27, 2024
1 parent e834140 commit 615f913
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion modules/programs/waybar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ in {
"Highly customizable Wayland bar for Sway and Wlroots based compositors.";
Documentation = "https://github.com/Alexays/Waybar/wiki";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
};

Service = {
Expand Down
2 changes: 1 addition & 1 deletion modules/services/blueman-applet.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ with lib;
Unit = {
Description = "Blueman applet";
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
After = [ "graphical-session.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

Expand Down
2 changes: 1 addition & 1 deletion modules/services/network-manager-applet.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ in {
Unit = {
Description = "Network Manager applet";
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
After = [ "graphical-session.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

Expand Down
2 changes: 1 addition & 1 deletion modules/services/poweralertd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ in {
Unit = {
Description = "UPower-powered power alerter";
Documentation = "man:poweralertd(1)";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

Expand Down
1 change: 1 addition & 0 deletions modules/services/swayidle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ in {
Description = "Idle manager for Wayland";
Documentation = "man:swayidle(1)";
ConditionEnvironment = "WAYLAND_DISPLAY";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

Expand Down
1 change: 1 addition & 0 deletions modules/services/wlsunset.nix
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ in {
systemd.user.services.wlsunset = {
Unit = {
Description = "Day/night gamma adjustments for Wayland compositors.";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ KillMode=mixed
Restart=on-failure

[Unit]
After=graphical-session-pre.target
After=graphical-session.target
Description=Highly customizable Wayland bar for Sway and Wlroots based compositors.
Documentation=https://github.com/Alexays/Waybar/wiki
PartOf=graphical-session.target
1 change: 1 addition & 0 deletions tests/modules/services/swayidle/basic-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
Type=simple
[Unit]
After=graphical-session.target
ConditionEnvironment=WAYLAND_DISPLAY
Description=Idle manager for Wayland
Documentation=man:swayidle(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ WantedBy=test.target
ExecStart=@wlsunset@/bin/wlsunset -L 128.8 -T 6000 -g 0.6 -l 12.3 -t 3500

[Unit]
After=graphical-session.target
Description=Day/night gamma adjustments for Wayland compositors.
PartOf=graphical-session.target

0 comments on commit 615f913

Please sign in to comment.