6

I'm now using dwm window manager and I know I can set rules to specify a application to a certain tag like this:

static const Rule rules[] = {
    /* xprop(1):
    *  WM_CLASS(STRING) = instance, class
    *  WM_NAME(STRING) = title
    */
    /* class      instance    title       tags mask     isfloating   monitor */
    { "Gimp",     NULL,       NULL,       0,            True,        -1 },
    { "Google-chrome",  NULL, NULL,       1 << 1,       False,       -1 }, // set chrome's tab. 2013-12-13
    { "UXTerm",    NULL,      "proxy",    1 << 8,       False,       -1 }, // let goagent proxy run in tab #9. 2013-12-13
};

Now I want to run several chrome instances with different webpages specified to different tags. The problem is some of the webpages' titles are dynamic. So I think set rules by title is not a good practice.

Here is my question: how to set the instance name of Google-chrome (or any X11 application) so I can create the rules by instance name.

Yang Liu
  • 148
  • 10

1 Answers1

1

For Chrome (or Chromium), you can change the second element of WM_CLASS by launching it with the --class="myClass" flag on startup (documentation). This will affect the class column of your dwm config, though, and not the instance one, which would be the first element of the WM_CLASS array.

The solution, then, might be to use --app=URI instead, which does sort of create discrete instances with "fixed" names which are based on the input URI. This solves the problem of the dynamic tab title; drawback however is that in --app mode you can only have one tab (and it's borderless).

As for the general question, one could use wmctrl to change the window class manually: http://tripie.sweb.cz/utils/wmctrl/