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

Doug Torrance <[email protected]> Wed, 26 Apr 2017 17:40:32 -0400
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
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
---
 libdockapp/src/wmgeneral.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libdockapp/src/wmgeneral.c b/libdockapp/src/wmgeneral.c
index c624193..b491502 100644
--- a/libdockapp/src/wmgeneral.c
+++ b/libdockapp/src/wmgeneral.c
@@ -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;
-- 
2.7.4


-- 
To unsubscribe, send mail to [email protected].