how to determine which composite manager is running

24,942

Solution 1

You can use inxi.

inxi -Gxx | grep compositor

The output looks like this

           alternate: ati,fbdev compositor: compton resolution: <xdpyinfo missing> 

and you can see that Compton is currently being used as a compositor. With no compositor, there is no grep match.

Switches:

  • -G Show graphics info (card(s), driver, display protocol (if available), display server, resolution, renderer, OpenGL version).
  • -xx Show extra, extra data. (with -G, show chip vendor:product ID for each video card; OpenGL compatibility version; compositor (experimental); alternate Xorg drivers.

Solution 2

I don't have either Compton or Mutter installed, but the xcompmgr sample X composition manager doesn't bother to determine if another composition manager is running, but goes on and just calls XCompositeRedirectSubwindows() and handles the error that may be generated by it in the handler installed with XSetErrorHandler:

static int
error (Display *dpy, XErrorEvent *ev)
{
    ...
    if (ev->request_code == composite_opcode &&
        ev->minor_code == X_CompositeRedirectSubwindows)
    {
        fprintf (stderr, "Another composite manager is already running\n");
        exit (1);

This seems to be the only possible way to do it: XCompositeGetOverlayWindow() will always succeed and map the overlay window, whether it's already in use or not:

CompositeGetOverlayWindow

This request indicates that the client wishes to use the Composite Overlay Window of this screen. If this Composite Overlay Window has not yet been mapped, it is mapped by this request.

Note:

Mutter is implemented as a dynamic library (usually loaded by gnome-shell), not as a separate process.

grep -sl mutter /proc/*/maps

on Linux will find all the processes that are using it.

Share:
24,942

Related videos on Youtube

Trevor
Author by

Trevor

Updated on September 18, 2022

Comments

  • Trevor
    Trevor almost 2 years

    I'm using Arch Linux, and have both Gnome and the i3 window manager installed. When running i3, I'm trying to initiate the composite manager Compton. But trying to do so results in the following error:

    $ compton
    [ 04/11/2019 22:32:36.443 register_cm FATAL ERROR ] Another composite manager is already running
    

    I think this means that Compton is already running, or Mutter is running, but I'm not sure which.

    Is there a command I can use to determine which composite manager is currently running?

  • Trevor
    Trevor about 5 years
    So are you suggesting that I use Xcompmgr instead of Compton and Mutter?
  • Trevor
    Trevor about 5 years
    pgrep compton seems to work, but when using Gnome pgrep mutter doesn't return anything
  • mosvy
    mosvy about 5 years
    No, I had just misinterpreted your question into something more complex like "how to determine if any composite manager is running on a display?" or "find the clients which had called XCompositeGetOverlayWindow". Sorry.
  • mosvy
    mosvy about 5 years
    pgrep mutter doesn't return anything because mutter is implemented as a dynamic lib loaded by gnome-shell, not as a separate process. grep -sl mutter /proc/*/maps to find the pid of any process that may using mutter (or something using lsof, but I was never able to learn how to use lsof)
  • Codebling
    Codebling over 4 years
    On Arch, install the AUR inxi package
  • mirh
    mirh over 4 years
    Take note, for some reasons not all *actual* compositors are going to be shown there. inxi -Sxx should do it instead (even though, at least without wmctrl installed, it is simply a lookup table checking running processes AFAICT)
  • Codebling
    Codebling over 4 years
    @mirh -S only shows system info, I don't think that will show any additional compositors. I think you're right that inxi does not heuristically/canonically detect compositors, it can only detect compositors that it knows about. I noticed that picom is missing since the rename of the fork, so I added it. Let me know if you noticed any other missing compositors.