Re: Developer setups for user D-Bus service files?

2022-01-12 Thread Friedrich W. H. Kossebau
Am Mittwoch, 12. Januar 2022, 11:49:26 CET schrieb David Edmundson:
> > This triggered yet another idea with me, and I came across
> > https://www.freedesktop.org/software/systemd/man/environment.d.html
> > upon which I tried to add a file
> > /home/mydevuser/.config/environment.d/60-test.conf
> > with the content
> > --- 8< ---
> > XDG_DATA_DIRS=/home/mydevuser/my/share::${XDG_DATA_DIRS:-/usr/local/share/
> > :/ usr/share/}
> > --- 8< ---
> > logged into a new session et voilà, the session D-Bus now sees my D-Bus
> > service files and starts the services as expected.
> 
> The equivalent for non-systemd people is to setup `pam_env` with user
> env turned on to do the same thing at roughly the same time.

Okay, will read up on that more.

> The drawback is you're always affecting that user, it's not on a per
> login basis, which works for you, but not everyone.

Yes, there seem to be multiple workflows/use-cases, so there seems to be need 
for multiple solutions.

The one I am looking at here is when working on single apps/services, in the 
usual fashion when using kdesrc-build which also modifies the user's 
.bashrc/.zshrc file for persistent addition of the local installed software,

This is where I look for the counterpart to ensure also D-Bus service files 
will be seen, so would be fine with a similar grave change of user settings.

Not yet looked further, only later today/this week, but guess I/we should look 
more at that for this use case?

Cheers
Friedrich




Re: Developer setups for user D-Bus service files?

2022-01-12 Thread David Edmundson
> This triggered yet another idea with me, and I came across
> https://www.freedesktop.org/software/systemd/man/environment.d.html
> upon which I tried to add a file
> /home/mydevuser/.config/environment.d/60-test.conf
> with the content
> --- 8< ---
> XDG_DATA_DIRS=/home/mydevuser/my/share::${XDG_DATA_DIRS:-/usr/local/share/:/
> usr/share/}
> --- 8< ---
> logged into a new session et voilà, the session D-Bus now sees my D-Bus
> service files and starts the services as expected.
>

The equivalent for non-systemd people is to setup `pam_env` with user
env turned on to do the same thing at roughly the same time.
The drawback is you're always affecting that user, it's not on a per
login basis, which works for you, but not everyone.

David


Re: Developer setups for user D-Bus service files?

2022-01-11 Thread Friedrich W. H. Kossebau
Am Dienstag, 11. Januar 2022, 22:49:47 CET schrieb David Edmundson:
> I did start another idea.
> 
> If you populate the dev session environment variables *really* early
> must we even go through pam you can set your XDG_DATA_DIRS before DBus
> daemon has loaded it will then have the right stuff.
> I made a patch doing that: https://github.com/sddm/sddm/pull/1370
> which is merged but not released:

This triggered yet another idea with me, and I came across
https://www.freedesktop.org/software/systemd/man/environment.d.html
upon which I tried to add a file
/home/mydevuser/.config/environment.d/60-test.conf
with the content
--- 8< ---
XDG_DATA_DIRS=/home/mydevuser/my/share::${XDG_DATA_DIRS:-/usr/local/share/:/
usr/share/}
--- 8< ---
logged into a new session et voilà, the session D-Bus now sees my D-Bus 
service files and starts the services as expected.

Something to investigate more post-sleep, at least for systemd systems?

Good night for today
Friedrich




Re: Developer setups for user D-Bus service files?

2022-01-11 Thread Friedrich W. H. Kossebau
Am Dienstag, 11. Januar 2022, 22:49:47 CET schrieb David Edmundson:
> >at least with systemd controlled start (but possibly also before
> 
> Since forever.

Okay, guessed so, as I had found decade old queries trying to solve similar 
challenges, though systemd also is that age, thus was not that sure :)

> >So, what standard approach should we take as developers here?
> 
> Personally I would say developers should avoid having a system
> installed KDE, you're only making life harder for yourself.

And for other users on the system (even one one's "safe" user account) which 
would like to only run released and packaged software :)

> For systemd services...

Myself not yet into systemd services, currently only trying to get D-Bus 
services working for user-local installs, but I guess this is related on 
systemd systems?

> 
> I did start another idea.
> 
> If you populate the dev session environment variables *really* early
> must we even go through pam you can set your XDG_DATA_DIRS before DBus
> daemon has loaded it will then have the right stuff.
> I made a patch doing that: https://github.com/sddm/sddm/pull/1370
> which is merged but not released:

Is this something that could be achieved also by editing whatever config files 
for now? And again in a way that it only is applied for a certain user 
account?
Those X-SDDM-Env entries, they though also would be only global, so I would 
need a separate workspace session config file, which then appears also for 
everyone else as option on login, right? Not ideal for shared systems. And 
also not perfect for a system where a user just wants their custom-made 
utility software to run in their user account on the provided company 
computer, like person working in a lab.

FWIW, I was hoping there was a way to add some entries to the D-Bus config 
files, which would add a  only for a certain user, or perhaps even 
an  only done for a certain user (perhaps relying on 
ignore_missing=yes).
But I found no such condition, and the  tags only works with final 
strings by what I saw in the code, no variable substitution (doc/busconfig.dtd 
is undocumented, boo).

Cheers
Friedrich




Re: Developer setups for user D-Bus service files?

2022-01-11 Thread David Edmundson
>at least with systemd controlled start (but possibly also before

Since forever.

>So, what standard approach should we take as developers here?

Personally I would say developers should avoid having a system
installed KDE, you're only making life harder for yourself.
Then things are relatively easy. You still have to do some editing of
/etc/ but only once and you have no confusions.



But I appreciate that's not a good solution for everyone. So to
brainstorm some options.

For systemd services I couldn't find a good solution so on a dev
session on startup they copy all relevant files to
$XDG_RUNTIME_DIR/whatever then reload everything.
This is copied from gnome (I think they then run a nested systemd
--user maybe dbus too?)

https://invent.kde.org/plasma/plasma-workspace/-/blob/master/login-sessions/startplasma-dev.sh.cmake



I did start another idea.

If you populate the dev session environment variables *really* early
must we even go through pam you can set your XDG_DATA_DIRS before DBus
daemon has loaded it will then have the right stuff.
I made a patch doing that: https://github.com/sddm/sddm/pull/1370
which is merged but not released:


It's not perfect, you still have the issue of polkit/system dbus. It
also has a scope of lasting for the duration that the user is logged
in, not the duration you're in Plasma; but probably fixes 90% of
cases.

David


Re: Developer setups for user D-Bus service files?

2022-01-11 Thread Friedrich W. H. Kossebau
Am Dienstag, 11. Januar 2022, 19:38:09 CET schrieb Friedrich W. H. Kossebau:
> YOUR INPUT NEEDED
> So, what standard approach should we take as developers here? Ideally we all
> do something similar, so any issues hit are more easy to
> understand/reproduce when we discuss them.

And ideally that solution should allow to limit the settings effect to the 
specific user account, to work for those having multiple users on the same 
system which should not be affected by the experiments of that one user 
account.

Cheers
Friedrich