[dev] [dwm][swallow] Apply dwm rules after swallowing child window

From: Ilias Clifton <adilias3_AT_gmx.com>
Date: Fri, 1 May 2020 07:18:25 +0200

Hi All,

I've applied the 'swallow' patch : https://dwm.suckless.org/patches/swallow/, which allows a terminal to 'swallow' a window opened by a child process in the terminal, eg. xlock.

Can someone assist me in applying the dwm rules to this 'swallowed' window?

For example, if I have a rule setup for xclock to appear on tag6 on my second monitor:

/* class instance title tags mask isfloating isterminal noswallow monitor */
{ "XClock", NULL, NULL, 1 << 5, 1, 0, 0, 1 },

When xclock is launched via dmenu, it appears on the correct tag and monitor.

However, if I launch xlcock from a terminal, it is correctly swallowed by the terminal, but it does not get moved to the correct tag and monitor.

I've tried adding applyrules(p) to the swallow function - it's close - but the window ends up borked, and no longer plays nice in the stack.

Can any one offer suggestions on what I'm doing wrong?

void
swallow(Client *p, Client *c)
{
  if (c->noswallow || c->isterminal)
    return;

  detach(c);
  detachstack(c);

  setclientstate(c, WithdrawnState);
  XUnmapWindow(dpy, p->win);

  p->swallowing = c;
  c->mon = p->mon;

  Window w = p->win;
  p->win = c->win;
  c->win = w;
  updatetitle(p);
+ applyrules(p);
  arrange(p->mon);
  XMoveResizeWindow(dpy, p->win, p->x, p->y, p->w, p->h);
  configure(p);
  updateclientlist();

}


Cheers,

Ilias
Received on Fri May 01 2020 - 07:18:25 CEST

This archive was generated by hypermail 2.3.0 : Fri May 01 2020 - 07:24:08 CEST