Re: [hackers] [dmenu] [PATCH] Set class name on menu window
On Fri, Nov 03, 2017 at 12:15:55AM +0100, Hiltjo Posthuma wrote:
> On Thu, Nov 02, 2017 at 10:29:15AM -0700, Omar Sandoval wrote:
> > On Thu, Nov 02, 2017 at 06:19:44PM +0100, Hiltjo Posthuma wrote:
> > > On Thu, Nov 02, 2017 at 02:10:35AM -0700, Omar Sandoval wrote:
> > > > This is useful for, e.g., compton.
> > > > ---
> > > > dmenu.c | 8 ++++++++
> > > > 1 file changed, 8 insertions(+)
> > > >
> > > > diff --git a/dmenu.c b/dmenu.c
> > > > index d605ab4..2a16ad8 100644
> > > > --- a/dmenu.c
> > > > +++ b/dmenu.c
> > > > _AT_@ -545,6 +545,7 @@ setup(void)
> > > > XIM xim;
> > > > Window w, dw, *dws;
> > > > XWindowAttributes wa;
> > > > + XClassHint *ch;
> > > > #ifdef XINERAMA
> > > > XineramaScreenInfo *info;
> > > > Window pw;
> > > > _AT_@ -613,6 +614,13 @@ setup(void)
> > > > win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0,
> > > > CopyFromParent, CopyFromParent, CopyFromParent,
> > > > CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
> > > > + ch = XAllocClassHint();
> > > > + if (ch) {
> > > > + ch->res_name = "dmenu";
> > > > + ch->res_class = "dmenu";
> > > > + XSetClassHint(dpy, win, ch);
> > > > + XFree(ch);
> > > > + }
> > > >
> > > > /* open input methods */
> > > > xim = XOpenIM(dpy, NULL, NULL, NULL);
> > > > --
> > > > 2.15.0
> > > >
> > > >
> > >
> > > Meh, can't you just use the process name?
> >
> > No, because dmenu doesn't set _NET_WM_PID either, so there's no way to
> > map the window to a process :) I don't think compton and other similar
> > stuff supports keying on process name, anyways.
> >
>
> Then it should be changed/fixed in (your local) compton. Then all applications
> can benefit and all the applications don't need to be patched.
>
> There are too many _NET_WM_CRAP already.
It's not a matter of changing compton. There's just no way to identify
dmenu windows because dmenu doesn't set any window properties. WM_CLASS
is a standard ICCCM property that almost every X application sets
(including st). _NET_WM_PID is a red herring; I just pointed it out
because it _could_ be used to find the process name like you suggested,
but dmenu doesn't set it and WM_CLASS is the normal way to do it
anyways.
Received on Fri Nov 03 2017 - 06:03:19 CET
This archive was generated by hypermail 2.3.0
: Fri Nov 03 2017 - 06:12:20 CET