X11 Multiple Monitor DPI trick

One issue with x11 is that there is no per monitor dpi property, there is only a global dpi property. Hidpi content doesn’t work properly on windows either as windows will simply upscale windows when using different dpi per monitor, making the window content blurry, unless the application supports different dpi per monitor. This is also an issue under wayland as currently compositors simply upscale xwayland applications, making them blurry. A solution for this with x11 is to set the monitor scale with xrandr to make a monitor behave as if it’s using a large resolution than it actually is and then setting programs dpi scaling with Xft.

X11 myth: X11 is not secure

Wayland advocates often complain about “security” in x11. One of the complaints is how you can have a keylogger without sudo privileges (for example xinput can do this). This video shows xkbcat, a keylogger for x11 being restricted to windows it owns only, preventing keylogging. Bottom right is xkbcat running in a terminal and top right is a window it owns. As you can see, it can only see keys that were input to a window it owns.

Accessing X11 window texture without copying

X11 has an extension called XComposite, which are often used by compositors, but these features can also be used in regular programs for getting direct access to the opengl texture associated with an X11 window. This is done using the XCompositeRedirectWindow, XCompositeNameWindowPixmap, glXCreatePixmap and glXBindTexImageEXT functions. See window-texture for a code example or for simple functions to use in your program. I’ve used this feature to make the fastest fully GPU accelerated screen (window) recorder on linux.