[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Xorg reconfigure on keyboard/VGA screen connect with systemd?

Hello martin f krafft.

I'm not an expert on the topic but will try to help fill in some
info which might be useful for you.

On Thu, Nov 12, 2015 at 06:49:00PM +1300, martin f krafft wrote:
> Hello,
> Can I use systemd to automatically run scripts as the owner of an
> X session when a USB keyboard or a VGA screen are connected to the
> local machine? Or what other mechanism would you use?

As far as I'm aware there's no "production ready" solution for this
yet (in Debian).

> In the past, doing so automatically would involve some sort of hook
> in /etc (invoked as root), which would then have to /bin/su to the
> user (hoping it'd even know to whom), import the Xauthority and then
> run the command. What a hack.

You probably want to use something like this still, but please
beware that in testing/unstable X is now running without root
privilegies normally (unless you use a Display Manager which still
starts X as root or you use the xserver-xorg-legacy package that was
introduced for those who want the old behaviour back).
This probably only simplifies your task by removing some steps
from your hack.

> systemd's integrates with everything desktop-ey, so I am led to
> believe it should be possible to do better nowadays.
> How? Does anyone have an example?

I believe there are plans to make it possible to handle "user services"
in similar fashion to how systemd handles system services.

If you want to experiment with this, then looking at the arch wiki
is (as usual) probably a good start:

If you do, an equivalent page on the Debian wiki would be awesome!

> Or if systemd is (still) not the right tool for the task, are there
> more modern approaches people use?
> Thanks,


Andreas Henriksson

Reply to: