Giter VIP home page Giter VIP logo

wl_framework's Introduction

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_framework's People

Contributors

consolatis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

wl_framework's Issues

wlctrl object id: not a static UID?

@Consolatis

I've been examining your wl_framework code for ideas (I'm thinking of writing a secure clipboard manager). In wlctrl, I thought the idea behind the object ids is that they were static UIDs per window. But they are not. What seems to happen is that the numbering acts like a stack, with the lowest number always referring to the newest window, but with each new window incrementing the object ids of all of the older ones.

Is there something more like a static window UID in the protocol?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.