Skip to content

Instantly share code, notes, and snippets.

@dperelman
dperelman / x11_watch_active_window.py
Last active January 9, 2024 16:16 — forked from ssokolow/x11_watch_active_window.py
python-xlib example which reacts to changing the active window
#!/usr/bin/env python3
# Based on code by Stephan Sokolow
# MIT-licensed
# Source: https://gist.github.com/ssokolow/e7c9aae63fb7973e4d64cff969a78ae8
"""python-xlib example which reacts to changing the active window/title.
Requires:
- Python
- python-xlib
#!/usr/bin/env python
# pkg-config --variable=xcbincludedir xcb-proto
import six
import re
import sys
from collections import namedtuple
def err(*args):
sys.stderr.write(' '.join(str(a) for a in args) + '\n')
#!/usr/bin/env python
from __future__ import print_function
import collections
import fileinput
import sys
plop = collections.defaultdict(list)