libdockapp: Do not include pathnames in Window Name and Class Properties

Patch by Corin-EU from GitHub [1].

In libdockapps file wmgeneral.c, wname is set from argv[0] and is then used
to set the window name and class resource. Often applications are called with
their full path which then means that the window name has a path in it,
thereby requiring an unwieldy path specific string for "Name" in WMState if
the applet is to be captured in the WM dock.

The simple solution is that wname should be the basename of argv[0] to
ensure that the window name for the applet is the simple and obvious one.
Thus the inclusion of header file libgen.h is required.

Just say "no" to path slashes "/" in window name/class resources ....

[1] https://github.com/d-torrance/dockapps/issues/5
This commit is contained in:
Doug Torrance 2017-04-26 17:40:32 -04:00 committed by Carlos R. Mafra
parent 139c230a8a
commit fa7743bc58

View file

@ -69,6 +69,7 @@
#include <stdio.h> /* for fprintf, stderr, NULL, etc */
#include <stdlib.h> /* for exit, free */
#include <string.h> /* for strcmp, strdup, strcspn, etc */
#include <libgen.h> /* for basename */
/*****************/
/* X11 Variables */
@ -396,7 +397,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
unsigned int borderwidth = 1;
XClassHint classHint;
char *display_name = NULL;
char *wname = argv[0];
char *wname = basename (argv[0]);
XTextProperty name;
XGCValues gcv;