Skip to content

Consolatis/wl_framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scope

wl_framwork is a pure Python implementation of the Wayland wire protocol and a (very) small subset of Wayland protocols with a focus on integrating well into existing event loops. Following event loops are supported:

  • poll()
  • asyncio
  • GLib / Gtk

Adding more event loop integrations (like for Qt or kqueue) should be trivial. See DummyIntegration. PRs welcome.

Dependencies

None

Reliability

This software is in alpha stage. API breakage may occur.

Executing examples

$ python3 -m examples.wl_monitor
$ PYTHONPATH=. examples/wl_monitor.py
$ ./run_example examples/wl_monitor.py

Supported protocols

Examples

  • wl_monitor Console monitor for window and clipboard changes. Good starting point for an overview of the API + shows how to use it with asyncio.
  • wlctrl Very basic console control of windows.
  • wl_example_panel Very basic but fully functional tasklist panel in 225 SLOC. Requires python-gi + GTK3 and GtkLayerShell typelibs.
  • wl_virtual_keyboard Shows how to use the virtual keyboard protocol.

AsyncIO

The whole framework is synchronous, so no async def nor await are to be seen.
However, care is taken to not block the eventloop for unreasonable time which is accomplished internally by using callbacks. Sometimes those callbacks are provided by the framework user, for example when requesting the content of the current clipboard selection. They can thus be wrapped into a Future which gets its result set on the synchronous callback.

The wayland connection itself is kept in a blocking state but only read from in a readable notification by the event loop. Writing however is being done without waiting for a writeable notification which should be fine on a local Unix socket connection. This may change in the future if deemed necessary. Open an issue if you can think of negative side effects of the current design.

Projects using wl_framework

About

Pure Python Wayland framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published