1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 03:29:45 +01:00

treewide: use graphical-session.target for GUI services

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 <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2024-08-31 23:59:14 +02:00
parent e83414058e
commit 6a9f87b3aa
No known key found for this signature in database
GPG key ID: E13DFD4B47127951
64 changed files with 71 additions and 67 deletions

View file

@ -19,7 +19,7 @@ in {
systemd.user.services.numlockx = {
Unit = {
Description = "NumLockX";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -308,8 +308,8 @@ in {
Description =
"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" ];
PartOf = [ cfg.systemd.target ];
After = [ cfg.systemd.target ];
};
Service = {

View file

@ -54,7 +54,7 @@ in {
Unit = {
Description = "Amberol music player daemon";
Requires = [ "dbus.service" ];
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -36,7 +36,7 @@ in {
systemd.user.services.autorandr = {
Unit = {
Description = "autorandr";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -63,7 +63,7 @@ in {
systemd.user.services.barrierc = {
Unit = {
Description = "Barrier Client daemon";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Install.WantedBy = [ "graphical-session.target" ];

View file

@ -32,7 +32,7 @@ in {
systemd.user.services.batsignal = {
Unit = {
Description = "batsignal - battery monitor daemon";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -24,7 +24,7 @@ in {
Unit = {
Description = "Blanket daemon";
Requires = [ "dbus.service" ];
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" "pipewire.service" ];
};

View file

@ -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" ];
};

View file

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

View file

@ -36,7 +36,7 @@ in {
Service.ExecStart = "${pkgs.devilspie2}/bin/devilspie2";
Unit = {
Description = "devilspie2";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Install.WantedBy = [ "graphical-session.target" ];

View file

@ -180,7 +180,7 @@ in {
systemd.user.services.dunst = {
Unit = {
Description = "Dunst notification daemon";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -51,7 +51,7 @@ in {
Unit = {
Description = "Easyeffects daemon";
Requires = [ "dbus.service" ];
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" "pipewire.service" ];
};

View file

@ -56,7 +56,7 @@ in {
Unit = {
Description = "Flameshot screenshot tool";
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
After = [ "graphical-session.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers = mkIf (cfg.settings != { }) [ "${iniFile}" ];
};

View file

@ -88,7 +88,7 @@ in {
Unit = {
Description = "Fnott notification daemon";
Documentation = "man:fnott(1)";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -119,7 +119,7 @@ in {
systemd.user.services.fusuma = {
Unit = {
Description = "Fusuma services";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -79,7 +79,7 @@ in {
systemd.user.services.grobi = {
Unit = {
Description = "grobi display auto config daemon";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -215,7 +215,7 @@ in {
systemd.user.services.gromit-mpx = {
Unit = {
Description = "Gromit-MPX";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers = [
"${config.xdg.configFile."gromit-mpx.cfg".source}"

View file

@ -79,7 +79,7 @@ in {
Unit = {
ConditionEnvironment = "WAYLAND_DISPLAY";
Description = "hypridle";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers =
[ "${config.xdg.configFile."hypr/hypridle.conf".source}" ];

View file

@ -73,7 +73,7 @@ in {
Unit = {
ConditionEnvironment = "WAYLAND_DISPLAY";
Description = "hyprpaper";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers =
[ "${config.xdg.configFile."hypr/hyprpaper.conf".source}" ];

View file

@ -40,7 +40,7 @@ in {
Unit = {
Description =
"Adds communication between your desktop and your smartphone";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
@ -69,7 +69,7 @@ in {
Unit = {
Description = "kdeconnect-indicator";
After = [
"graphical-session-pre.target"
"graphical-session.target"
"polybar.service"
"taffybar.service"
"stalonetray.service"

View file

@ -18,7 +18,7 @@ in {
systemd.user.services.keynav = {
Unit = {
Description = "keynav";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -50,7 +50,7 @@ in {
Unit = {
Description = "Discord Rich Presence for MPD";
Documentation = "https://github.com/JakeStanger/mpd-discord-rpc";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {

View file

@ -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" ];
};

View file

@ -36,7 +36,7 @@ in {
systemd.user.services.nextcloud-client = {
Unit = {
Description = "Nextcloud Client";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -33,7 +33,7 @@ in {
systemd.user.services.notify-osd = {
Unit = {
Description = "notify-osd";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -23,7 +23,7 @@ in {
systemd.user.services.opensnitch-ui = {
Unit = {
Description = "Opensnitch ui";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -24,7 +24,7 @@ in {
systemd.user.services.owncloud-client = {
Unit = {
Description = "Owncloud Client";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

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

View file

@ -30,7 +30,7 @@ in {
Unit = {
Description = "PulseAudio system tray";
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
After = [ "graphical-session.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -60,7 +60,7 @@ in {
systemd.user.services.pbgopy = {
Unit = {
Description = "pbgopy server for sharing the clipboard between devices";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {

View file

@ -310,7 +310,7 @@ in {
systemd.user.services.picom = {
Unit = {
Description = "Picom X11 compositor";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -58,7 +58,7 @@ in {
systemd.user.services.plex-mpv-shim = {
Unit = {
Description = "Plex mpv shim";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -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" ];
};

View file

@ -52,7 +52,7 @@ in {
Unit = {
Description = "Pulseeffects daemon";
Requires = [ "dbus.service" ];
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" "pulseaudio.service" ];
};

View file

@ -76,7 +76,7 @@ in {
systemd.user.services.random-background = {
Unit = {
Description = "Set random desktop background using feh";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -189,7 +189,7 @@ in {
in {
Description = "${programName} colour temperature adjuster";
Documentation = serviceDocumentation;
After = [ "graphical-session-pre.target" ] ++ geoclueAgentService;
After = [ "graphical-session.target" ] ++ geoclueAgentService;
Wants = geoclueAgentService;
PartOf = [ "graphical-session.target" ];
};

View file

@ -39,7 +39,7 @@ in {
Unit = {
Description = "Remmina remote desktop client";
Documentation = "man:remmina(1)";
Requires = [ "graphical-session-pre.target" ];
Requires = [ "graphical-session.target" ];
};
Service = {

View file

@ -23,7 +23,7 @@ in {
systemd.user.services.rsibreak = {
Unit = {
Description = "RSI break timer";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -117,7 +117,7 @@ in {
systemd.user.services.xss-lock = {
Unit = {
Description = "xss-lock, session locker service";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
@ -140,7 +140,7 @@ in {
systemd.user.services.xautolock-session = {
Unit = {
Description = "xautolock, session locker service";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -30,7 +30,7 @@ with lib;
Unit = {
Description =
"Dynamically adjust the screen color temperature twice every minute";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -107,7 +107,8 @@ in {
Description = "Idle manager for Wayland";
Documentation = "man:swayidle(1)";
ConditionEnvironment = "WAYLAND_DISPLAY";
PartOf = [ "graphical-session.target" ];
After = [ cfg.systemdTarget ];
PartOf = [ cfg.systemdTarget ];
};
Service = {

View file

@ -96,7 +96,7 @@ in {
Description = "Swaync notification daemon";
Documentation = "https://github.com/ErikReider/SwayNotificationCenter";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
ConditionEnvironment = "WAYLAND_DISPLAY";
};

View file

@ -121,7 +121,7 @@ in {
Unit = {
Description = cfg.tray.package.pname;
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
After = [ "graphical-session.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};
@ -146,7 +146,7 @@ in {
Unit = {
Description = "syncthingtray";
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
After = [ "graphical-session.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -28,7 +28,7 @@ in {
Description =
"An unofficial GUI wrapper around the Tailscale CLI client";
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
After = [ "graphical-session.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };

View file

@ -361,7 +361,7 @@ in {
systemd.user.services.twmnd = {
Unit = {
Description = "twmn daemon";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers =
[ "${config.xdg.configFile."twmn/twmn.conf".source}" ];

View file

@ -116,7 +116,7 @@ in {
Unit = {
Description = "udiskie mount daemon";
Requires = lib.optional (cfg.tray != "never") "tray.target";
After = [ "graphical-session-pre.target" ]
After = [ "graphical-session.target" ]
++ lib.optional (cfg.tray != "never") "tray.target";
PartOf = [ "graphical-session.target" ];
};

View file

@ -45,7 +45,7 @@ in {
systemd.user.services.unclutter = {
Unit = {
Description = "unclutter";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -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" ];
};

View file

@ -60,11 +60,11 @@ in {
Unit = mkMerge [
{
Description = "xcape";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
}
(mkIf (config.home.keyboard != null && config.home.keyboard != { }) {
After = [ "graphical-session-pre.target" "setxkbmap.service" ];
After = [ "graphical-session.target" "setxkbmap.service" ];
})
];

View file

@ -34,7 +34,7 @@ in {
systemd.user.services.xembed-sni-proxy = {
Unit = {
Description = "XEmbed SNI Proxy";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -50,7 +50,7 @@ in {
systemd.user.services.xscreensaver = {
Unit = {
Description = "XScreenSaver";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
# Make sure the service is restarted if the settings change.

View file

@ -183,7 +183,7 @@ in {
systemd.user.services.xsuspender = {
Unit = {
Description = "XSuspender";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers =
[ "${config.xdg.configFile."xsuspender.conf".source}" ];

View file

@ -8,7 +8,7 @@ KillMode=mixed
Restart=on-failure
[Unit]
After=graphical-session-pre.target
After=sway-session.target
Description=Highly customizable Wayland bar for Sway and Wlroots based compositors.
Documentation=https://github.com/Alexays/Waybar/wiki
PartOf=graphical-session.target
PartOf=sway-session.target

View file

@ -20,7 +20,7 @@
RestartSec=5
[Unit]
After=graphical-session-pre.target
After=graphical-session.target
Description=Blanket daemon
PartOf=graphical-session.target
PartOf=pipewire.service

View file

@ -4,7 +4,7 @@ ExecStart=@fnott@/bin/fnott -c /home/hm-user/.config/fnott/fnott.ini
Type=dbus
[Unit]
After=graphical-session-pre.target
After=graphical-session.target
Description=Fnott notification daemon
Documentation=man:fnott(1)
PartOf=graphical-session.target

View file

@ -6,6 +6,6 @@ Environment=PATH=@coreutils@/bin:@xdotool@/bin:@xorg.xprop@/bin
ExecStart=@fusuma@/bin/fusuma
[Unit]
After=graphical-session-pre.target
After=graphical-session.target
Description=Fusuma services
PartOf=graphical-session.target

View file

@ -6,7 +6,7 @@ ExecStart=@parcellite@/bin/parcellite --no-icon
Restart=on-abort
[Unit]
After=graphical-session-pre.target
After=graphical-session.target
After=tray.target
Description=Lightweight GTK+ clipboard manager
PartOf=graphical-session.target

View file

@ -6,7 +6,7 @@ Environment=PATH=@paprefs@/bin:@pavucontrol@/bin
ExecStart=@pasystray@/bin/pasystray -g
[Unit]
After=graphical-session-pre.target
After=graphical-session.target
After=tray.target
Description=PulseAudio system tray
PartOf=graphical-session.target

View file

@ -7,6 +7,6 @@ Restart=always
RestartSec=3
[Unit]
After=graphical-session-pre.target
After=graphical-session.target
Description=Picom X11 compositor
PartOf=graphical-session.target

View file

@ -7,7 +7,7 @@ Restart=on-failure
RestartSec=3
[Unit]
After=graphical-session-pre.target
After=graphical-session.target
Description=Gammastep colour temperature adjuster
Documentation=https://gitlab.com/chinstrap/gammastep/
PartOf=graphical-session.target

View file

@ -7,7 +7,7 @@ Restart=on-failure
RestartSec=3
[Unit]
After=graphical-session-pre.target
After=graphical-session.target
Description=Redshift colour temperature adjuster
Documentation=http://jonls.dk/redshift/
PartOf=graphical-session.target

View file

@ -50,6 +50,7 @@
Type=simple
[Unit]
After=graphical-session.target
ConditionEnvironment=WAYLAND_DISPLAY
Description=Idle manager for Wayland
Documentation=man:swayidle(1)

View file

@ -24,7 +24,7 @@
Type=dbus
[Unit]
After=graphical-session-pre.target
After=graphical-session.target
ConditionEnvironment=WAYLAND_DISPLAY
Description=Swaync notification daemon
Documentation=https://github.com/ErikReider/SwayNotificationCenter

View file

@ -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