How to reliably execute a script if a monitor is added or removed? #5644
Replies: 2 comments
-
udev rule? Can try to grab drm events on your card and either run a script directly or use a single-run systemd service to start your script. Then you could check for the monitor status in /sys/class/drm if you need to perform actions based on specific monitors. Run |
Beta Was this translation helpful? Give feedback.
-
Hi, Regards |
Beta Was this translation helpful? Give feedback.
-
Hey all,
i've created a custom bar using eww and adapted it already such that it will displayed on each monitor if a script is run.
Now I want to run this sript every time a monitor is connected or disconnected, ideally also after suspension triggered by the lid switch.
My initial try was listening to the
.socket.2
event in a script started on login and after the lid switch is off:However the socket-connection is terminated immediately after the workspaces reload and resort them.
Kanshi would allow me to run the script if my profile changes, but does not allow me directly to observe if a monitor is disconnected. This solution would also require to create a profile for any possible combination of monitors I would encounter and exec the script in each profile.
Does anybody has an idea?
Beta Was this translation helpful? Give feedback.
All reactions