Squib of the day: extend plugin possibilities

For once, this isn’t about an existing bug– well, there’s a tenuous connection to GNOME bug 311428.

Several of the recent squibs have resulted in the observation that an external script could be made to do the work.  This is true for responding to keypresses, but for problems such as performing some action whenever a window opens it gets a bit harder– the external script must run all the time and either monitor X events or, as devilspie does, get libwnck to monitor X events on its behalf.

It might be a better idea if Metacity (or libwnck) could be given a list of commands to run when windows open, and possibly on other events, to make writing plugins easier.

The (fast!) default would be the empty list, of course.

Another event which it would make sense to be able to tie plugins into is window role change, so that a window-matching script could learn automatically.

It would also be sensible to allow programs to be executed when mouse buttons other than the main three were pressed (so you could launch an Exposé clone by pressing the shoulder button, for example).

Photo © Katie Sutton, cc-by-nc-sa.


  1. Posted February 4, 2009 at 1:57 pm | Permalink

    What should Metacity do if a spawned command receives SIGSEGV? Or dies in some other horrible way that also takes the parent? This calls for a sandboxing environment which in turn calls for an embedded scripting language rather than executing random bits of code. This in turn… wait, Seed?

  2. Posted February 4, 2009 at 4:24 pm | Permalink

    I don’t want Metacity to turn into Sawfish II!

    We already spawn external programs on keypress events and it never brings us down. There’s nothing particularly different in spawning programs on fancy mouse button events, or even on window opening.

  3. Posted February 4, 2009 at 4:27 pm | Permalink

    What happens if the “window opening event” script results in a new window being open? ;)

  4. Posted February 4, 2009 at 4:42 pm | Permalink

    Good question. We have to consider these things carefully.

    This is where we need a comparative analysis of other WMs; I assume someone’s run into such a problem before now.

  5. eTM
    Posted February 4, 2009 at 8:25 pm | Permalink

    I like the idea.

    @regarding opening window event script -> opening window event: may be even desired. Imho: the script designer has to take care and e.g. suppress new window for subsequent runs.