Hi Anselm,

On Tue, May 20, 2008 at 04:13:35PM +0200, Anselm R. Garbe wrote:
> please recheck attached version of setmwname as a binary with
> the JDK grey blob issue.
> 
> Use
> 
> ; ./setwmname LG3D
> 
> and see if it works. If so, then consider this for getting rid
> of Xmonad patches as well.

For me it doesn't work. Perhaps my java version is to old? Detailed info:
 * matlab r2007a
 * java version "1.6.0_05"
 * centos 5 (final)

'export AWT_TOOLKIT="MTOOLKIT"' does work.

Attached is a patch that makes setwmname print the _NET_WM_NAME when no
arguments are given, similar to hostname(1).

Regards,
-- 
Jeroen Schot
diff -ur setwmname-0.1.orig/setwmname.c setwmname-0.1/setwmname.c
--- setwmname-0.1.orig/setwmname.c	2008-05-21 12:44:43.678505000 +0200
+++ setwmname-0.1/setwmname.c	2008-05-21 12:36:25.560506000 +0200
@@ -19,16 +19,17 @@
 
 int
 main(int argc, char **argv) {
+	int status, format;
+	unsigned char *data = NULL;
+	unsigned long n, extra;
 	Display *dpy;
 	Window root, dummy;
-	Atom netwmcheck, netwmname, utf8_string;
+	Atom netwmcheck, netwmname, utf8_string, real;
 
-	if(argc == 2) {
-		if(!strncmp(argv[1], "-v", 3))
+	if(argc > 2)
+		eprint("usage: setwmname [name] [-v]\n");
+	if(argc == 2 && !strncmp(argv[1], "-v", 3))
 			eprint("setwmname-"VERSION", © 2008 Anselm R Garbe\n", stdout);
-	}
-	else
-		eprint("usage: setwmname <name> [-v]\n");
 
 	if(!(dpy = XOpenDisplay(0)))
 		eprint("setwmname: cannot open display\n");
@@ -36,8 +37,15 @@
 	netwmcheck = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
 	netwmname = XInternAtom(dpy, "_NET_WM_NAME", False);
 	utf8_string = XInternAtom(dpy, "UTF8_STRING", False);
-	XChangeProperty(dpy, root, netwmcheck, XA_WINDOW, 32, PropModeReplace, (unsigned char *)&root, 1);
-	XChangeProperty(dpy, root, netwmname, utf8_string, 8, PropModeReplace, (unsigned char *)argv[1], strlen(argv[1]));
+	if(argc == 1) {
+		status = XGetWindowProperty(dpy, root, netwmname, 0L, 32L, False, utf8_string, &real, &format, &n, &extra, (unsigned char **) &data);
+		if(status == Success && data != NULL)
+			printf("%s\n", data);
+		XFree(data);
+	} else {
+		XChangeProperty(dpy, root, netwmcheck, XA_WINDOW, 32, PropModeReplace, (unsigned char *)&root, 1);
+		XChangeProperty(dpy, root, netwmname, utf8_string, 8, PropModeReplace, (unsigned char *)argv[1], strlen(argv[1]));
+	}
 	XSync(dpy, False);
 	XCloseDisplay(dpy);
 	return 0;

Reply via email to