Frank Schmitt <[EMAIL PROTECTED]> writes:
> I like to have one terminal per computer I'm connected to and
> distinguish those by the icon in the window managers task bar. However,
> setting those icons is a real mess in most modern window managers. KDE
> offers a way which requires root access and placing properly named icons
> in /ush/share/icons, Gnome and Xfce don't have any possibility to
> manually specify an icon for some application at all.
>
> Therefor, I hacked up some lines of codes which allow to manually
> specify an icon for rxvt-unicode. It uses for this the _NET_WM_ICON
> window properties described at
> http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2507733
> which seems to be supported by all modern WM.
Find attached an enhanced patch which allows to specify the filename of
the icon image as a command line argument or with xresources.
Would it be possible to include the patch in rxvt-unicode? I'd be
willing to rework it according to your needs.
Yours,
Frank
--
Have you ever considered how much text can fit in eighty columns? Given that a
signature typically contains up to four lines of text, this space allows you to
attach a tremendous amount of valuable information to your messages. Seize the
opportunity and don't waste your signature on bullshit that nobody cares about.
Index: src/init.C
===================================================================
RCS file: /schmorpforge/rxvt-unicode/src/init.C,v
retrieving revision 1.253
diff -u -r1.253 init.C
--- src/init.C 15 Jul 2008 16:41:22 -0000 1.253
+++ src/init.C 26 Oct 2008 17:58:20 -0000
@@ -1137,6 +1137,43 @@
XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc,
&szHint, &wmHint, &classHint);
+# ifdef HAVE_AFTERIMAGE
+ ASImage *im = NULL;
+ if (rs [Rs_iconfile]){
+ im = file2ASImage(rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL);
+ if (im!=NULL){
+ int w=im->width;
+ int h=im->height;
+ int length=4*w*h+2*sizeof(int);
+ int* buffer = (int*)malloc(length);
+ int screen = DefaultScreen(dpy);
+ int depth = DefaultDepth( dpy, screen );
+ ASVisual* asv = create_asvisual( dpy, screen, depth, NULL );
+ ASImage* result = scale_asimage (asv, im,
+ w,h,ASA_ARGB32,
+ 100, ASIMAGE_QUALITY_DEFAULT);
+ destroy_asimage(&im);
+ if (buffer && result){
+ buffer[0]=w;
+ buffer[1]=h;
+ memcpy(buffer+2,result->alt.argb32,4*w*h);
+ destroy_asimage(&result);
+ Atom net_wm_icon = XInternAtom(dpy, "_NET_WM_ICON", False);
+ Atom cardinal = XInternAtom(dpy, "CARDINAL", False);
+ XChangeProperty(dpy, top, net_wm_icon, cardinal, 32,
+ PropModeReplace, (const unsigned char*) buffer, 2+w*h);
+ free(buffer);
+ }
+ else{
+ if (!buffer) rxvt_warn ("Memory allocation for icon hint failed!\n");
+ if (!result) rxvt_warn ("Image transformation to ARGB of image for icon hint failed!\n");
+ }
+ }
+ else{
+ rxvt_warn ("Loading of image for icon hint failed!\n");
+ }
+ }
+#endif
#if ENABLE_FRILLS
if (mwmhints.flags)
Index: src/rsinc.h
===================================================================
RCS file: /schmorpforge/rxvt-unicode/src/rsinc.h,v
retrieving revision 1.26
diff -u -r1.26 rsinc.h
--- src/rsinc.h 15 Jun 2008 13:54:15 -0000 1.26
+++ src/rsinc.h 26 Oct 2008 17:58:20 -0000
@@ -116,4 +116,5 @@
#ifdef HAVE_AFTERIMAGE
def (blendtype)
def (blurradius)
+ def (iconfile)
#endif
Index: src/xdefaults.C
===================================================================
RCS file: /schmorpforge/rxvt-unicode/src/xdefaults.C,v
retrieving revision 1.137
diff -u -r1.137 xdefaults.C
--- src/xdefaults.C 15 Jun 2008 13:54:15 -0000 1.137
+++ src/xdefaults.C 26 Oct 2008 17:58:23 -0000
@@ -264,6 +264,7 @@
#ifdef HAVE_AFTERIMAGE
STRG (Rs_blendtype, "blendType", "blt", "string", "background image blending type - alpha, tint, etc..."),
STRG (Rs_blurradius, "blurRadius", "blr", "HxV", "Gaussian Blur radii to apply to the root background"),
+ STRG (Rs_iconfile, "iconFile", "icon", "filename", "Filename of icon offered to window manager"),
#endif
INFO ("e", "command arg ...", "command to execute")
};
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode