News for hackers. Stuff that matters.
Re:Understanding the working of X11 from the ground up (2017) by pedrocr on Sunday September 22, 2019 @06:41AM (#21040661)
>like I have a script that OCR a region of the screen when I press a button (the coordinates depend of the app that runs)

This is easy to do. Something like grim to take the screenshot of whatever region you want:

https://github.com/emersion/grim

And calculate the coordinates you need by querying the window manager. In sway (i3 compatible tiling WM) that would be:

$ swaymsg -t get_tree

To get a JSON of all the windows currently open and do whatever math is needed.

You can also do a hand selection using slurp:

https://github.com/emersion/slurp

It works together with grim like this:

$ grim -g "$(slurp)" screenshot.png

Having recently moved from X to Wayland there are still some things missing sometimes but they're not many. If you want a DE at least GNOME and I think KDE as well are making the switch reasonably seamless. And there are some features that Wayland solves much more thoroughly (e.g., tear free output, fractional scaling). The network transparency part, that is often brought up but rarely used in X is also being delivered:

https://lists.freedesktop.org/archives/wayland-devel/2019-Au...

There are no comments on this comment yet.