2

Specifically, I want to display text and images on the monitor, on top of all other windows, but without being clickable or in any way possible to interact with - clicks on it should go straight through to whatever window is underneath.

So far, my research has led me to try and read the X documentation regarding the composite overlay window, but unfortunately I have not been able to get anywhere with it. The only resource I found that was of any help is a small nodejs library (node-x11) which unfortunately appears to have been abandoned while still incomplete, and which I was not able to get to work. Apparently there is also a python library, but that seemed to be even less complete than the nodejs on.

Benubird
  • 18,551
  • 27
  • 90
  • 141

1 Answers1

2

node-x11 author here (and it's not abandoned, I just only add functionality I need or users request, so if you missing something please fill an issue!)

You can use GetOverlayWindow from composite extension:

Version 0.3 of the protocol adds the Composite Overlay Window, which provides compositing managers with a surface on which to draw without interference. This window is always above normal windows and is always below the screen saver window. It is an InputOutput window whose width and height are the screen dimensions. Its visual is the root visual and its border width is zero. Attempts to redirect it using the composite extension are ignored. This window does not appear in the reply of the QueryTree request. It is also an override redirect window. These last two features make it invisible to window managers and other X11 clients. The only way to access the XID of this window is via the CompositeGetOverlayWindow request. Initially, the Composite Overlay Window is unmapped.

CompositeGetOverlayWindow returns the XID of the Composite Overlay Window. If the window has not yet been mapped, it is mapped by this request. When all clients who have called this request have terminated their X11 connections the window is unmapped.

Composite managers may render directly to the Composite Overlay Window, or they may reparent other windows to be children of this window and render to these. Multiple clients may render to the Composite Overlay Window, create child windows of it, reshape it, and redefine its input region, but the specific arbitration rules followed by these clients is not defined by this specification; these policies should be defined by the clients themselves.

node-x11 example:

var x11 = require('x11');
x11.createClient(function(err, display) {
  var X = display.client;
  var root = display.screen[0].root;
  X.require('composite', function(err, Composite) {
    Composite.GetOverlayWindow(root, function(err, overlayId) {
      // now you can draw on overlayId window here.
    });
  });
});
Andrey Sidorov
  • 24,905
  • 4
  • 62
  • 75
  • 1
    Yes, I saw that. I was able to get it to create a new window (with X.CreateWindow) and then draw on it, but I was never able to get it to draw on the overlay window, and after a couple of days work I gave up in frustration - I think I just don't understand nodejs well enough to figure out how it works, and it's at that awkward height where it's too far from the C for the X docs to help, but still too low level to guess at. – Benubird Mar 11 '16 at 11:50
  • I made it partly work by making a normal window then parenting it to the overlay, but I moved on to PyQt5 in the end – Heath Mitchell Feb 20 '21 at 14:21