Email or username:

Password:

Forgot your password?
Top-level
David JONES

@neauoire so some_little_program needs to know the X window ID to send events to. Some ideas: you could just type it in; some_little_program could observe what window has focus at the moment it starts and use that one forever; one of the programs (I'm not sure which one) could make you click on the target window and listen for the event and use the target of the click for all future events.

5 comments
Devil Lu Linvega

@drj Oooh! Yes, okay, let say I wanted to make it so some_little_program waits for a click on a window(`click on any window`), do you know how I can do this?

David JONES

@neauoire I only ever wrote 1 X11 program, but it was using XLib and none of the new-fangled framework nonsense (it was on a DEC Ultrix machine in about 1994). I _think_ you "simply" call XNextEvent; see how xev.c does it gitlab.freedesktop.org/xorg/ap

I _think_ by default an X11 client gets all events (for all windows!) unless it has requested only events for particular windows (like their own, which most apps would do); i think that's XSelectInput.

Devil Lu Linvega

@drj aaah! amazing, thank you so much, that should be enough for me to get it working :)

ArBe

@neauoire @drj Not sure if this is helpful, but the `xprop` allows you to click on a window, and then it prints its properties to stdout. You could probably hook it up with a shell script, or maybe look into the source if you want to do something similar with the API

Go Up