3 ms·
You can probably write a udev rule for the Thunderbolt / USB-C port with either ACTION=="offline", "remove" or "online". "offline" is for when your system turn
by jorvi 2y ago
You can probably write a udev rule for the Thunderbolt / USB-C port with either ACTION=="offline", "remove" or "online".
"offline" is for when your system turns off or suspends, "online" vice versa, and "remove" is self-explanatory.
If you go with "offline", I'd look into hard disconnecting the monitors. This might cause monitor rearrangement (= you'll need to manually assign) or blinking on laptop bootup. Might also stop any charging. But that could be mitigated by checking the "subsystems" attribute.
If you go with "online", you probably need run some sort of clean-up / refresh script or rule
If you go with "remove", you'll need the same clean-up / refresh script.
It'll take some trial-and-error, but it'll be satisfying once it works. Also highly recommended to check the NixOS repositories and official wiki and Arch wiki to see if your laptop or monitors have workarounds for their quirks.