Re: [dwm] setwmname 0.1

2008-06-17 Thread Anselm R. Garbe
On Wed, May 21, 2008 at 12:58:26PM +0200, Jeroen Schot wrote:
 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).

I applied your patch, the future version of setwmname is called
wmname.

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] setwmname 0.1

2008-05-21 Thread Jeroen Schot
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;


[dwm] setwmname 0.1

2008-05-20 Thread Anselm R. Garbe
Hi there,

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.

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361


setwmname-0.1.tar.gz
Description: Binary data