I'm currently trying to use Python to detect when the left mouse button is held, and then it starts sending this event quickly, not just once. What I basically want to do is that when the left mouse button is held down, it pushes and pushes again until you release it. But I'm a little puzzled by all of Xlib, I think this is very confusing actually. Any help on how to do this would be truly amazing. This is what I have so far:
import Xlib
import Xlib.display
def main():
display = Xlib.display.Display()
root = display.screen().root
while True:
event = root.display.next_event()
print event
if __name__ == "__main__":
main()
But, unfortunately, there is no way out in the console. After a quick search on the Internet, I found the following:
root.change_attributes(event_mask=Xlib.X.KeyPressMask)
root.grab_key(keycode, Xlib.X.AnyModifier, 1, Xlib.X.GrabModeAsync,
Xlib.X.GrabModeAsync)
, -, , . , -, , ? -, , , mouseclick. . ( , script ...)