Detect output change #2271
Unanswered
MaximMaximS
asked this question in
Q&A
Replies: 1 comment 2 replies
-
You can use Wayfire's IPC, here is a small script (you need the #!/usr/bin/python3
from wayfire_socket import WayfireSocket
import os
addr = os.getenv('WAYFIRE_SOCKET')
events_sock = WayfireSocket(addr)
events_sock.watch(['output-added', 'output-removed'])
while True:
msg = events_sock.read_message()
print(msg) # will contain either output-added or output-removed event You need to copy the As an alternative, there is also a work-in-progress Last but not least, you can use the Wayland protocol itself, but that is much harder to get started. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I need to run a command whenever an output connects or disconnects.
I tried this:
but it results in high CPU usage.
When I add sleep into the loop, it doesn't use a lot of cpu, but when the output disconnects just for a tiny bit, it doesn't get caught by the script.
Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions