@readwithai - X - blog - machine-aid reading
Get information about an X11 window in machine-readable JSON. This is similar to the xwininfo information
You can install this using pipx:
pipx install json-xwinfo
json-xwininfo
You can information about the currently focused window using:
json-xwininfo --focused
Most programming languages provides facilities to easily parse JSON. For using this information at the moment line you may wish to use the jq.
This tool is obviously inspired by xwininfo and at the moment wraps this tool and parses the output. This tool usings Xlib. You may prefer to use this library to obtain this information rather than using this tool for more "self-contained" pieces of software.
The command-line tool jc is designed to convert the output of a number of command-line tools to JSON. It does not support xwininfo at the moment, and this tool contains additional functionality - specifically to select the currently focused window, but support could be easily added and may be added in the future.
I was experimenting with displaying information at particular positions on the screen - such as the top left corner of the window. The shell code necessary to do this was a little too involved to count as a good idea so I decided to wrap this into tool.
Information is partial. At the moment this tool wraps xwininfo and parses the output.
If you find this tool useful you can support it by giving me money on ko-fi. I would suggest a $1 dollar donation if you find this tool useful. This will incentivise me to create similar tools.
You may also like to look at my json-wmctrl which can be used to list and select windows and raise them.
You might like to read some of my writing about the note taking app Obsidian.
I am @readwithai. I make tools related to reading, research and productivity sometimes with Obsidian.
You can follow me on X where I post about tools like this and a range of topics. Or if reading and research sounds interesting you could read my blog.