<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 19/09/2021 21:39, Michael Biebl
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAGWsdOjPfubtkb9VCT67if87Vrpcj6QiCovHcoZBwCjap8eC0g@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">A useful command in this context is
systemctl --user show-environment</pre>
</blockquote>
<br>
OK, that was helpful. But leads to another question.<br>
<br>
How to run the service only if KDE_FULL_SESSION=true?<br>
<br>
<br>
<blockquote type="cite"
cite="mid:CAGWsdOjPfubtkb9VCT67if87Vrpcj6QiCovHcoZBwCjap8eC0g@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">
Am So., 19. Sept. 2021 um 11:53 Uhr schrieb Mantas Mikulėnas
<a class="moz-txt-link-rfc2396E" href="mailto:grawity@gmail.com"><grawity@gmail.com></a>:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">
On Sun, Sep 19, 2021 at 4:05 AM Ed Greshko <a class="moz-txt-link-rfc2396E" href="mailto:ed.greshko@greshko.com"><ed.greshko@greshko.com></a> wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">
Not a everyday systemd service writer....
I've written a user service file to start an app on login. It works well for Xorg with Environment=DISPLAY=:0.
But I've found that under Wayland the DISPLAY=:1 after a logout of Xorg and login to a
Wayland session.
What would be the proper way to get the DISPLAY environment varible use it as opposed
to "hard" coding it?
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
The proper way is to have the desktop environment upload DISPLAY (and whatever else is relevant, such as XAUTHORITY or WAYLAND_DISPLAY or XDG_SESSION_TYPE) into systemd --user, so that it would be automatically available to your service without doing anything special.
For example, gnome-session does this for GNOME (it calls systemd's UnsetAndSetEnvironment in gsm-util.c), and /etc/X11/xinit/xinitrc.d/50-systemd-user.sh handles the bare minimum for other Xorg-based desktops (when startx is used).
If KDE integrates with systemd --user in any way (i.e. if it actually has a "plasma-core.target" that you mention), I'd really expect it to do the same before it tries to start its own targets, otherwise they would be kind of useless.
--
Mantas Mikulėnas
</pre>
</blockquote>
</blockquote>
<br>
</body>
</html>