Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #160468 > unrolled thread

Xorg reconfigure on keyboard/VGA screen connect with systemd?

Started bymartin f krafft <madduck@madduck.net>
First post2015-11-12 07:20 +0100
Last post2015-11-12 16:40 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.debian.user


Contents

  Xorg reconfigure on keyboard/VGA screen connect with systemd? martin f krafft <madduck@madduck.net> - 2015-11-12 07:20 +0100
    Re: Xorg reconfigure on keyboard/VGA screen connect with systemd? Andreas Henriksson <andreas@fatal.se> - 2015-11-12 14:40 +0100
    Re: Xorg reconfigure on keyboard/VGA screen connect with systemd? Julien Cristau <jcristau@debian.org> - 2015-11-12 16:40 +0100

#160468 — Xorg reconfigure on keyboard/VGA screen connect with systemd?

Frommartin f krafft <madduck@madduck.net>
Date2015-11-12 07:20 +0100
SubjectXorg reconfigure on keyboard/VGA screen connect with systemd?
Message-ID<qtToJ-5fA-3@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

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?

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.

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?

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

Thanks,

-- 
@martinkrafft | http://madduck.net/ | http://two.sentenc.es/
 
(a)bort, (r)etry, (p)retend this never happened
 
spamtraps: madduck.bogus@madduck.net

[toc] | [next] | [standalone]


#160481

FromAndreas Henriksson <andreas@fatal.se>
Date2015-11-12 14:40 +0100
Message-ID<qu0gz-136-41@gated-at.bofh.it>
In reply to#160468
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:
https://wiki.archlinux.org/index.php/Systemd/User

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,

HTH.

Regards,
Andreas Henriksson

[toc] | [prev] | [next] | [standalone]


#160488

FromJulien Cristau <jcristau@debian.org>
Date2015-11-12 16:40 +0100
Message-ID<qu28G-2eq-33@gated-at.bofh.it>
In reply to#160468

[Multipart message — attachments visible in raw view] — view raw

On Thu, Nov 12, 2015 at 18:49:00 +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?
> 
It should be easy enough to write an X client listening for DeviceNotify
(for new input devices) or ConfigureNotify (for output changes) on the
root window.  gnome-settings-daemon has a "hotplug-command" under
org.gnome.settings-daemon.peripherals.input-devices in its settings that
can do the former at least.

Cheers,
Julien

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web