[comp.windows.x] icon geometries?

boberg@june.cs.washington.edu (Bruce Oberg) (06/30/89)

i used to start my X11R3/Ultrix2.3 day with a bunch of windows
spawned by xdm from my .xsession file. just recently, however, i've
had this uncontrollable urge to have most everything start up as their
respective icons via "-iconic" clauses in my .xsession.

having found woefully numerous ways to do virtually everything else
i've ever wanted to do with X, imagine my astonishment at the
non-existence of any convienient way to specify startup locations for
my icons. no matter what "-geometry" says, they all end up on top of
each other at +0+0! stumbling through the manuals, i can find no way
to change this. but wait!, i find in the Xtoolkit *sources* that there
are two resources called iconX and iconY which can be set to specify
the icon's location. but do they understand "-geometry"'s [-+]XX[-+]YY
format for placement at various corners?  you might think they would.
you'd be wrong.

please, oh benevolent and merciful X11R3 gods, tell me there is a
hidden "-icongeometry" parameter encrypted into the Xtoolkit sources!
please deliver me from the hell of having all my icons in the upper
left corner! i will be forever grateful.



bruce


"...a just machine to make big decisions,
 programmed by fellows, with compassion and vision..."

 -donald fagen

ugwiles@sunybcs.uucp (Dale Wiles) (06/30/89)

In article <8620@june.cs.washington.edu> boberg@june.cs.washington.edu (Bruce Oberg) writes:
>
>i used to start my X11R3/Ultrix2.3 day with a bunch of windows
>spawned by xdm from my .xsession file. just recently, however, i've
>had this uncontrollable urge to have most everything start up as their
>respective icons via "-iconic" clauses in my .xsession.
>

I use uwm as a manager, and this works for me:

      v--------------------------------------v
xterm -iconic -xrm 'XTerm*iconGeometry:-50+30' -geometry +50+60 -fn -adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-1 +ut -n sybil -e sybil&


The hi-lighted section pops up a xterm window (On our computer
"Sybil") as an icon 50 pixels left of the right side, and 30 pixels
below the top.

While on the subject of Icons, does anyone know how to substitute an
arbitrary bitmap for the dull icons that uwm defaults to?

*Emacs came, Dale, lad, Emacs came.               *(c) Marty Storer, Goog Inc.
*Disclaimer: I disclaim nothing! I am THE official*Looks more (bonk)
*opinion of my college, state, country and of all *like a sick-e-more (bonk)
*carbon based life forms in the universe.         *to me. Yogi the Space Bear.

swick@ATHENA.MIT.EDU (Ralph R. Swick) (06/30/89)

> tell me there is a
> hidden "-icongeometry" parameter encrypted into the Xtoolkit sources!
> please deliver me from the hell of having all my icons in the upper
> left corner!

Sorry, there's no such convenient argument.  I could try to justify this
on the basis that the ICCCM doesn't generally allow applications to
specify their icon size, only the position; so the general-purpose
geometry syntax is inappropriate, but I suspect you might laugh at me.

Actually, the window manager developers seem to be generally loath to
give up much control over icons and proliferating yet more command
line arguments that might or might not be respected by the wm seemed
like an unwise thing to do.  It would be inappropriate to re-use the
-geometry argument, as that specifically applies to the application's
window(s).  Granted, it's less convenient but you can always say

	myprog -xrm '*iconX:nnn' -xrm '*iconY:mmm'

or even,

	myprog -name mystyle1

	mystyle1.iconX:nnn
	mystyle1.iconY:mmm

Some applications have added a command line argument to specify x&y
as a single option (e.g. xterm).  This may have been a mistake, but
since I was the perpetrator (well, it _was_ there before X11) it
would be hypocritical for me to say so directly :-)

usenet@cps3xx.UUCP (Usenet file owner) (07/01/89)

We are running X-11 R3.  "xterm" has a # option that will set the icon
geometry.  The only place I found information on it was in "xterm -help".
An example is:

xterm -g 80x24+0+0 -C -iconic -name "CONSOLE" -xb $HOME/.tinysun.xbm \#+894+62

The backslash in front of the # sign is so that csh doesn't take the
rest of the line as a comment.

As for having bitmaps as icons a news article by Suresh Krishnamurthy
shows how to patch xterm to allow this.  I have applied the patches to a
copy of xterm here and they seem to work really well.  Here is the article:

cps3xx!eecae!shadooby!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!tektronix!orca!krish
From: krish@orca.WV.TEK.COM (Shelley Gallaher)
Newsgroups: comp.windows.x
Subject: Icon bitmap for (X11) xterms
Message-ID: <3311@orca.WV.TEK.COM>
Date: 11 May 89 23:52:45 GMT
Reply-To: krish@orca.WV.TEK.COM (Suresh Krishnamurthy)
Organization: Tektronix, Inc., Wilsonville,  OR.
Lines: 86
Keywords: xterm, icon, bitmap

I have modified (X11) xterm to display bitmap for icons.  You
have to change only main.c file.  

The syntax is similar to X10 xterm, except that
instead of "-ib", I have used "-xb" (xterm bitmap).

"xterm -iconic -xb bitmap_filename"  would invoke xterm as an icon
using specified file as icon bitmap.  Note that bitmap_filename should
include the path also.

Good bye labels, hello bitmap icons.

-- Suresh

-------------------------------------------------------------------------------
Suresh Krishnamurthy		Net: krish@gray.WV.TEK.COM
Hinditron International Inc,	ARPA: krish%gray.WV.TEK.COM@RELAY.CS.NET
(Work) (503)-685-2973		UUCP: gray.WV.TEK.COM!krish@uunet.UU.NET
-------------------------------------------------------------------------------

Here are the diffs for main.c in R3.


----------------------  beginning of main.c (R3) diff -------------------------
246a247,248
#define	MAKE_ICON		/* I think this should be defined in Makefile */
 
251a254,256
#ifdef  MAKE_ICON
     char *iconfile;
#endif  MAKE_ICON
276a282,285
 #ifdef  MAKE_ICON
     {"iconFile", "IconFile", XtRString, sizeof(char *),
         offset(iconfile), XtRString, (caddr_t) NULL},
 #endif  MAKE_ICON
340a350,352
 #ifdef  MAKE_ICON
 {"-xb",         "*iconFile",    XrmoptionSepArg,        (caddr_t) NULL},
 #endif  MAKE_ICON
1085a1098,1100
 #ifdef  MAKE_ICON
         Pixmap  xtermPixmap;
 #endif  MAKE_ICON
1245c1260,1262
 
---
 #ifdef  MAKE_ICON
         MakeCuteIcon( resource.iconfile );	/* Set icon pixmap */
 #endif  MAKE_ICON
2275a2293,2325
 
 #ifdef  MAKE_ICON
 
 MakeCuteIcon( icon_filename )
 	char    *icon_filename;
 {
 	int     junk;
 	Pixmap  xtermPixmap;
 	XWMHints  wmhints, *hints;
 
 	if (!strlen(icon_filename))             /* if no icon file specified */
 		return;
 
 	XReadBitmapFile( XtDisplay(XtParent(term)),
 		XtWindow(XtParent(term)), icon_filename,
 		&junk, &junk, &xtermPixmap, &junk, &junk );
 /*
  *	Get WMHints and save initial_state and position, otherwise 
  *	iconic option and icon position may not work properly.
  */
 	hints = XGetWMHints( XtDisplay(XtParent(term)),
 			     XtWindow(XtParent(term)) );
 	wmhints.flags = InputHint | StateHint | IconPixmapHint | IconPositionHint;
 	wmhints.initial_state = hints->initial_state; /* take care of iconic */
 	wmhints.input = hints->input;
 	wmhints.icon_pixmap = xtermPixmap;
 	wmhints.icon_x = hints->icon_x;         /* restore icon position */
 	wmhints.icon_y = hints->icon_y;
 	XSetWMHints( XtDisplay(XtParent(term)),
 		     XtWindow(XtParent(term)), &wmhints);
 }
 #endif  MAKE_ICON
 
----------------------  end of main.c (R3) diff -------------------------


I hope this helps...  John

                                   /------\
+----------------------------------+      +----------------------------------+
|   John F. DeStefano              |      |  COGITO COGITO, ERGO COGITO SUM  |
|   CPS Undergraduate -- AI/KBS    +------+    "I think that I think;        |
|   Michigan State University      +------+     therefore, I think I am."    |
|   destefan@frith.egr.msu.edu     |      |        - Ambros Bierce           |
+----------------------------------+      +----------------------------------+
                                   \------/