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...