Enabling and disabling external monitors based on laptop lid status

34 views
Skip to first unread message

Mads R. Havmand

unread,
Oct 4, 2018, 4:10:51 AM10/4/18
to qubes...@googlegroups.com
I'm scratching my head over this... How are people configuring their QubeOS 4 instances to enable and disable external monitors based on the laptops lid status?

Current laptop (EliteBook 1040 g2) works flawlessly with Qubes (even suspend...) and my only current issue is that I have to manually enable and disable screens when I dock the machine.

Normally, I'd use ACPI hooks and I'm guessing this needs to be done in dom0 (I don't suppose any DomU's have access to reconfigure screens?) but acpid isn't available om dom0.

What would you recommend? I guess a possible solution could be to source an acpid RPM, or find the source code, and install that manually in dom0?

Best regards
Mads

Ivan Mitev

unread,
Oct 4, 2018, 4:59:35 AM10/4/18
to qubes...@googlegroups.com


On 10/4/18 11:10 AM, 'Mads R. Havmand' via qubes-users wrote:
> I'm scratching my head over this... How are people configuring their QubeOS 4 instances to enable and disable external monitors based on the laptops lid status?

I've been through this too - see below.

> Current laptop (EliteBook 1040 g2) works flawlessly with Qubes (even suspend...) and my only current issue is that I have to manually enable and disable screens when I dock the machine.

I too manually enable/disable screens but I have configured a keyboard
shortcut that runs a custom shell script with xrandr commands based on
the presence - or lack thereof - of my external monitor.
All it takes is to dock the laptop and hit the shortcut - lightning fast.

> Normally, I'd use ACPI hooks and I'm guessing this needs to be done in dom0 (I don't suppose any DomU's have access to reconfigure screens?) but acpid isn't available om dom0.

Yes this needs to be done in dom0.

On moderm distros systemd handles lid events provided no other
application has inhibited ("overridden") the event. See `man logind.conf`.

In the case of Qubes, Xfce's power manager overrides HandleLidSwitch=
(but not HandleLidSwitchedDocked=). There's an option in xfce power
manager to turn the display off when the lid is closed but it won't be
able to differentiate when the laptop's docked or not so it's useless.

IIRC there are a few ways to run a script based on lid events without
resorting to installing acpid (which is not even guaranteed to work):
eg. listening for dbus lid close/open events, monitoring
/proc/acpi/button/lid/LID/state, ... ; An alternative is to run stuff on
dock/undock events, via dbus and/or udev rules.

In the end my hacky keyboard shortcut "solution" worked well enough that
I didn't spend time to investigate the solutions above...

Chris Laprise

unread,
Oct 4, 2018, 2:29:13 PM10/4/18
to Ivan Mitev, qubes...@googlegroups.com
This is one of several problems I resolved by simply switching back to
KDE. Xfce had too many bugs and omissions for me.
https://www.qubes-os.org/doc/kde/


--

Chris Laprise, tas...@posteo.net
https://github.com/tasket
https://twitter.com/ttaskett
PGP: BEE2 20C5 356E 764A 73EB 4AB3 1DC4 D106 F07F 1886
Reply all
Reply to author
Forward
0 new messages