flacjacket / pywlroots

Python binding to the wlroots library using cffi
University of Illinois/NCSA Open Source License
53 stars 14 forks source link

Tutorial of pywlroots usage, and how to make keyboard/mouse events and get current mouse position as in Xlib #110

Closed VictorGimenez closed 1 year ago

VictorGimenez commented 2 years ago

Hello there,

All these days I am struggling by myself to find solutions on pywayland and pywlroots/wlroots that do the same roles when are about do key press/release, mouse press/release and get the current mouse position on the screen. For example, considering Xlib is necessary to generate a display object (Display(os.environ['DISPLAY'])) and this object contains with itself some methods responsible to access screen attributes:

Display(os.environ['DISPLAY']).screen().root.query_pointer._data.coord["root_x"] (To get the x current mouse location) and Display(os.environ['DISPLAY']).screen().root.query_pointer._data.coord["root_y"] (To get the y current mouse location) considering that Display(object) belongs from Xlib.display module.

As well as the fake_input(Display(os.environ['DISPLAY']), X.any_event, button, x=value_x,y_value_y) to make events such as mouse movement, button mouse press/release, and Display(os.environ['DISPLAY']).sync() to refresh the display state, considering that fake_input() belongs from Xlib.ext.xtest module and X from Xlib package.

Where could I see a tutorial from the pywayland and pywlroots usage? I saw https://github.com/flacjacket/pywlroots/blob/main/wlroots/wlr_types/virtual_pointer_v1.py and https://github.com/flacjacket/pywlroots/blob/main/wlroots/wlr_types/virtual_keyboard_v1.py but I have no idea how to use them. I am researching them also.