GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Syntactic sugar for property access · Issue #274 · python-xlib/python-xlib

Syntactic sugar for property access #274

New issue
Copy link
New issue
Copy link
Open
Open
Syntactic sugar for property access#274
Copy link

Description

@redhog
redhog
opened on Jul 10, 2024
Issue body actions

Heyas!

This is a solicitation for comments before I make a PR:

For my window manager, I have made a wrapper for python-xlib that adds a lot of convenience syntax sugar stuff. This does a lot of monkey patching, and I'd like to contribute this back to python-xlib as added methods to the core classes instead. None of this changes existing functionality, it just adds.

In particular, property access to windows is greatly simplified by having windows work as dictionaries of their properties, supporting all the usual operations (keys(), items(), in, win[name] = value etc). The dictionary keys are the python string equivalents of the ATOM:s.

Values are converted to/from python equivalents as needed to be convenient:
WINDOW are returned as
Xlib.xobject.drawable.Window objects, ATOMs, KEYCODEs and XCONSTs as python strings, STRINGs as bytess. Properties with length != 1 are converted to/from lists of the corresponding values.

I forsee some of these changes to be more easily accepted than other ones, so please feel free to browse through the above link and write here what you like and dislike!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.