Subject: FVWM: Hiding Icon images and Icon text seperately

From: John Benninghoff <[email-masked]>
Date: Mon, 19 Oct 1998 15:03:46 -0700

Using 'Style "*" NoIcons' in .fvwm2rc hides the icon image as well as the icon
text.  I want to just suppress the icon images.  Some applications such as rxvt
don't display an icon image but others do such as Netscape. ??

Is there a way to get the desired results?

johnb@barfly zsh: fvwm2 -version
[FVWM][main]:  Fvwm Version 2.0.46 compiled on May  7 1998 at 22:04:07

Running this on Redhat Linux 5.1

-- 
John Benninghoff
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked]
Date: Tue, 20 Oct 1998 00:14:01 +0100 (GMT)

> Running this on Redhat Linux 5.1

Just to be different I would like the converse, namely icons but no
text. I think I asked about this in the dim and distant past but got no
replies.

Cheers

Kim

---

From: Richard Lister <[email-masked]>
Date: Tue, 20 Oct 1998 11:11:29 -0400

On Tue, 20 Oct 1998 00:14:01 +0100 (GMT)
[email-masked] 
> > Is there a way to get the desired results?

I used to do exactly this, by saying something like:

  Style "*" Icon none

where "none" doesn't exist as a pixmap in your path.

> text. I think I asked about this in the dim and distant past but got no

I don't think this is possible. I tried

  Iconfont none

but it just defaults to fixed. A patch might not be too hard.

Ric

Richard J Lister, Georgetown Institute for Cognitive and Computational Sciences
Georgetown University Medical Center, Washington, DC 20007, USA
Phone: +1 202-687 2878
Email: [email-masked] 
Web: http://www.giccs.georgetown.edu/~ric/
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: John Benninghoff <[email-masked]>
Date: Tue, 20 Oct 1998 08:33:33 -0700

> where "none" doesn't exist as a pixmap in your path.

This works for most applications.  Thanks.  It still fails for Netscape
but I am looking into the X resource to modify to make it work.

-- 
John Benninghoff
http://my.netscape.com/

---

From: Richard Lister <[email-masked]>
Date: Tue, 20 Oct 1998 11:39:21 -0400

On Tue, 20 Oct 1998 08:33:33 -0700
John Benninghoff <[email-masked]> 
> but I am looking into the X resource to modify to make it work.

Aha! It's been a long time since I used this stuff (I use FvwmIconMan
now), but I just dug back into some of my old code. The following patch
should do the trick for you. Apply it to fvwm/icons.c, then say:

  Style "*" Icon NoPixmap

to override the icon set by the application.

I really thought the patch had been included into the distribution
by Chuck back around 2.0.44.

Brady ... want to stick it into the 2.0.47 beta? It's pretty trivial.

Anyway, here it is:

--- fvwm/icons.c.orig   Sun Jun  9 20:57:11 1996
+++ fvwm/icons.c        Thu Jun 13 10:57:54 1996
@@ -85,6 +85,14 @@
          (tmp_win->wmhints)&&(tmp_win->wmhints->flags & IconPixmapHint))
     GetIconBitmap(tmp_win);
 
+  /* Allow override of application icon using 'Icon NoPixmap' */
+  if ( (tmp_win->icon_bitmap_file != NULL) &&
+       !(strncasecmp(tmp_win->icon_bitmap_file, "NoPixmap", 8)) ) {
+    tmp_win->icon_p_height = 0;
+    tmp_win->icon_p_width = 0;
+  } 
+
+
   /* figure out the icon window size */
   if (!(tmp_win->flags & NOICON_TITLE)||(tmp_win->icon_p_height == 0))
     {

Cheers
Ric

---

From: John Benninghoff <[email-masked]>
Date: Tue, 20 Oct 1998 12:35:13 -0700

> should do the trick for you. Apply it to fvwm/icons.c, then say:

This didn't work but when I commented out the 2 functions above your diff
change, I got it to work.

johnb@barfly zsh: diff -u icons.c.orig icons.c
--- icons.c.orig        Mon Aug 11 07:39:04 1997
+++ icons.c     Tue Oct 20 11:09:48 1998
@@ -75,15 +75,26 @@
      (tmp_win->icon_p_height == 0)&&(tmp_win->icon_p_width == 0))
     GetXPMFile(tmp_win);

-  /* Next, See if the app supplies its own icon window */
+  /* Next, See if the app supplies its own icon window
   if((tmp_win->icon_p_height == 0)&&(tmp_win->icon_p_width == 0)&&
      (tmp_win->wmhints) && (tmp_win->wmhints->flags & IconWindowHint))
     GetIconWindow(tmp_win);
+  */

-  /* Finally, try to get icon bitmap from the application */
+  /* Finally, try to get icon bitmap from the application
   if((tmp_win->icon_p_height == 0)&&(tmp_win->icon_p_width == 0)&&
          (tmp_win->wmhints)&&(tmp_win->wmhints->flags & IconPixmapHint))
     GetIconBitmap(tmp_win);
+  */
+
+  /* Allow override of application icon using 'Icon NoPixmap' */
+  if ( (tmp_win->icon_bitmap_file != NULL) &&
+       !(strncasecmp(tmp_win->icon_bitmap_file, "NoPixmap", 8)) ) {
+    tmp_win->icon_p_height = 0;
+    tmp_win->icon_p_width = 64;
+    tmp_win->iconPixmap = None;
+  }
+

Commenting out GetIconBitmap(tmp_win) is what really did it, I think.

The icon text however is no longer trimmed regardless of the value of the width
parameter.  Strange.

I'm going to investigate FvwmIconMan, since it nearly does what I am looking
for.

---

From: John Benninghoff <[email-masked]>
Date: Tue, 20 Oct 1998 12:38:27 -0700

Can FvwmIconMan show just icon windows?  How?  What pattern can you
provide to the show/dontshow settings?

---

From: Richard Lister <[email-masked]>
Date: Tue, 20 Oct 1998 16:04:25 -0400

On Tue, 20 Oct 1998 12:35:13 -0700
John Benninghoff <[email-masked]> 
> change, I got it to work.

Hmm, strange, I seem to remember it working fine. I used to have a setup
close to what you're trying to achieve. Maybe the logic is a little
screwy (need 'else if' in a couple of places). At a cursory glance
it seems some of that section would benefit from a bit of a rewrite
anyway.

> Commenting out GetIconBitmap(tmp_win) is what really did it, I think.

Yup, Netscape is passing the pixmap hint to the WM, causing that
pixmap to be used.

> The icon text however is no longer trimmed regardless of the value of the width

I know what is happening here. With icon pixmaps the pixmap width is
used to calculate the width of the whole icon. When I first started using
no pixmaps on the icons I found that fvwm calculated the width based
on the icon title string length. This was OK, but some apps change
their icon title frequently (e.g. netscape urls, xterms which show CWD
in the title, etc). I decided I wanted the icon to grow or shrink with the
title on each iconify event. The following patch, which was adopted
into the main distribution, does that:

--- fvwm/icons.c.orig   Sun Jun  9 20:57:11 1996
+++ fvwm/icons.c        Thu Jun 13 10:55:51 1996
@@ -809,6 +809,15 @@
     else
       CreateIconWindow(tmp_win, def_x, def_y);
 
+  /* if no pixmap we want icon width to change to text width every iconify */
+  if( (tmp_win->icon_w != None) && (tmp_win->icon_pixmap_w == None) ) {
+    tmp_win->icon_t_width =
+      XTextWidth(Scr.IconFont.font,tmp_win->icon_name, 
+                 strlen(tmp_win->icon_name));
+    tmp_win->icon_p_width = tmp_win->icon_t_width+6;
+    tmp_win->icon_w_width = tmp_win->icon_p_width; 
+  }
+
   AutoPlace(tmp_win);
   tmp_win->flags |= ICONIFIED;
   tmp_win->flags &= ~ICON_UNMAPPED;

Looking at this it would probably be pretty straightforward to change
the behaviour so that, for example, all icons are say 64 pixels wide,
but show the full title when focussed. If that is what you want.

Ric

---

From: Richard Lister <[email-masked]>
Date: Tue, 20 Oct 1998 16:08:31 -0400

> The icon text however is no longer trimmed regardless of the value of the width

And I've just found *another* patch I did so that the icon gets dynamically
resized every time the icon title changes (without needing to manually
deiconify and iconify again). I don't think this one was adopted for some
reason.

--- fvwm/icons.c.orig   Fri Aug 16 11:30:38 1996
+++ fvwm/icons.c        Fri Aug 16 12:38:30 1996
@@ -334,9 +334,15 @@
   
   Tmp_win->icon_t_width = XTextWidth(Scr.IconFont.font,Tmp_win->icon_name, 
                                     strlen(Tmp_win->icon_name));
-  /* clear the icon window, and trigger a re-draw via an expose event */
-  if (Tmp_win->flags & ICONIFIED)
-    XClearArea(dpy, Tmp_win->icon_w, 0, 0, 0, 0, True);
+
+  if (Tmp_win->flags & ICONIFIED) {
+    /* if no pixmap make new icon as the title may have changed size */
+    if( Tmp_win->icon_pixmap_w == None )
+      Iconify(Tmp_win, 0, 0);
+    else
+      /* clear the icon window, and trigger a re-draw via an expose event */
+      XClearArea(dpy, Tmp_win->icon_w, 0, 0, 0, 0, True);
+  }
   return;
 }

I might play around with some of this stuff sometime soon and put it
all into one patch for Brady to check out.

Ric

---

From: Richard Lister <[email-masked]>
Date: Tue, 20 Oct 1998 16:20:09 -0400

> I'm going to investigate FvwmIconMan, since it nearly does what I am looking

Here's the setup I use. I find it invaluable for managing very large
numbers of windows, especially multiple terminals running telnets
to other machines.

It is M4 preprocessed, but you can easily strip that stuff out.

----------------------------------------------------------------------

Mouse 3 	R	N	Module FvwmIconMan Transient

m4_define(ICONFONT, `-adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*')

m4_define(XTERM_COLOUR, `CadetBlue')
m4_define(EMACS_COLOUR, `GoldenRod')
m4_define(DEFAULT_COLOUR, `SlateBlue3')
m4_define(NETWORK_COLOUR, `MediumAquamarine')

m4_define(CLASS_XTERM, `class=XTerm class=NXTerm class=XWsh')
m4_define(TITLE_ROOT, `title=root*')
m4_define(CLASS_EMACS, `class=Emacs')
m4_define(CLASS_NETWORK, `class=Netscape class=Mosaic class=Grail \
                          class=Xarchie class=Exmh')
m4_define(CLASS_FVWM, `class=Fvwm* icon=Fvwm*')

## 5 managers: 1 = all, 2 = root xterms, 3 = emacs, 4 = network clients,
##             5 = non-root xterms
*FvwmIconMan*nummanagers 5
*FvwmIconMan*resolution page
*FvwmIconMan*font ICONFONT

## can have (title), (icon), (class), (resource)
*FvwmIconMan*format %i

*FvwmIconMan*buttongeometry 150x0

*FvwmIconMan*shape True
*FvwmIconMan*usewinlist True 
*FvwmIconMan*DrawIcons True

## buttons are: {flat,up,down,raisededge,sunkedge} [forecolor backcolor]
*FvwmIconMan*plainbutton Up
*FvwmIconMan*focusbutton Up Black PaleVioletRed
*FvwmIconMan*selectbutton down
*FvwmIconMan*focusandselectbutton down

*FvwmIconMan*followfocus true

*FvwmIconMan*sort true

#*FvwmIconMan*[id*]action {Key,Mouse,Select} binding
##           args:            SendCommand manager window command
*FvwmIconMan*action Mouse 1 N sendcommand Iconify
*FvwmIconMan*action Mouse 2 N sendcommand DeiconifyFocusAndWarp
*FvwmIconMan*action Mouse 2 S sendcommand "Menu Window-Ops2 Window-Ops2"
*FvwmIconMan*action Mouse 3 N sendcommand RaiseLower
*FvwmIconMan*action Mouse 3 S sendcommand "Module FvwmIdent"

## show all windows except xterms & emacs
*FvwmIconMan*1*managergeometry 1x0-450+0
*FvwmIconMan*1*title      "FvwmIconMan: All windows"
*FvwmIconMan*1*iconname   "FvwmIconMan: All windows"
*FvwmIconMan*1*dontshow   resource=FvwmIconMan \
                          CLASS_XTERM \
			  CLASS_EMACS \
			  CLASS_NETWORK \
                          CLASS_FVWM
*FvwmIconMan*1*background DEFAULT_COLOUR
*FvwmIconMan*1*foreground White

## show just root xterms
*FvwmIconMan*2*managergeometry 1x0-0+0
*FvwmIconMan*2*show       TITLE_ROOT
*FvwmIconMan*2*title      "FvwmIconMan: Root XTerms"
*FvwmIconMan*2*iconname   "FvwmIconMan: Root XTerms"
*FvwmIconMan*2*background XTERM_COLOUR
*FvwmIconMan*2*foreground DarkRed

## show just non-root xterms
*FvwmIconMan*5*managergeometry 1x0-150+0
*FvwmIconMan*5*show       CLASS_XTERM
*FvwmIconMan*5*title      "FvwmIconMan: XTerms"
*FvwmIconMan*5*iconname   "FvwmIconMan: XTerms"
*FvwmIconMan*5*background XTERM_COLOUR
*FvwmIconMan*5*foreground Black

## show just emacs
*FvwmIconMan*3*managergeometry 1x0-300+0
*FvwmIconMan*3*show       CLASS_EMACS
*FvwmIconMan*3*title      "FvwmIconMan: Emacs"
*FvwmIconMan*3*iconname   "FvwmIconMan: Emacs"
*FvwmIconMan*3*background EMACS_COLOUR
*FvwmIconMan*3*foreground Black

## just show network clients
*FvwmIconMan*4*managergeometry 1x0-600+0
*FvwmIconMan*4*show       CLASS_NETWORK
*FvwmIconMan*4*title      "FvwmIconMan: Network"
*FvwmIconMan*4*iconname   "FvwmIconMan: Network"
*FvwmIconMan*4*background NETWORK_COLOUR
*FvwmIconMan*4*foreground Black

## transient window to pop up
*FvwmIconMan*transient*title "Global FvwmIconMan"
*FvwmIconMan*transient*Shape False
*FvwmIconMan*transient*plainbutton Flat
*FvwmIconMan*transient*focusbutton Flat LimeGreen PaleVioletRed
*FvwmIconMan*transient*resolution global
*FvwmIconMan*transient*managergeometry 1x0
*FvwmIconMan*transient*buttongeometry 300x0
*FvwmIconMan*transient*action Mouse 0 A sendcommand DeiconifyRaiseAndFocus
*FvwmIconMan*transient*background Gray25
*FvwmIconMan*transient*foreground LimeGreen
*FvwmIconMan*transient*selectbutton Up

----------------------------------------------------------------------

Cheers
Ric