1
0
Fork
You've already forked wl_framework
0
Pure Python Wayland framework
  • Python 99.9%
2024年10月06日 03:28:03 +02:00
examples examples/cosmic_workspaces.py: new test client 2024年07月24日 02:19:17 +02:00
wl_framework protocols/cosmic_workspaces: reduce log spam 2024年10月06日 03:27:34 +02:00
.gitignore initial commit 2022年01月13日 07:02:28 +01:00
__init__.py initial commit 2022年01月13日 07:02:28 +01:00
LICENSE initial commit 2022年01月13日 07:02:28 +01:00
pyproject.toml Increase version to 0.2 2024年10月06日 03:28:03 +02:00
README.md protocols/foreign_toplevel: add output tracking 2023年02月17日 13:51:48 +01:00
run_example initial commit 2022年01月13日 07:02:28 +01:00
TODO.md TODO: foreign toplevel output tracking 2022年01月28日 14:41:03 +01:00

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

  • (削除) wl_panel (削除ここまで) (not released yet)