[comp.soft-sys.andrew] easy suggestion for EZ

tobeye@NORTHSTAR.DARTMOUTH.EDU (Anthony Edwards) (01/28/91)

I just have a suggestion:  when I iconify an Ez window, I get a huge
file name in a box as the icon.  The huge file name is because we're on
NAFS which means all our directories start with at least
/afs/northstar.dartmouth.edu/user/...  How about only displaying the
filename without the path in it?  I think it's rare for someone to edit
the same named file in lots of directories or, if they did, they would
know by icon position which file is which.

So, can you shorten the name?


   - Anthony

gk5g+@ANDREW.CMU.EDU (Gary Keim) (01/29/91)

Excerpts from misc: 28-Jan-91 easy suggestion for EZ Anthony
Edwards@northsta (499+0)

> So, can you shorten the name?


Yes.  It's pretty trivial.  The only problem is the loss of information.

Excerpts from misc: 28-Jan-91 easy suggestion for EZ Anthony
Edwards@northsta (499+0)

> How about only displaying the filename without the path in it?  I think
> it's rare for someone to edit the same named file in lots of directories
> or, if they did, they would know by icon position which file is which.

It happens to me quite a bit.  I don't agree that icon position is
useful in discriminating between different editing sessions with common
filenames in different directories.

Excerpts from misc: 28-Jan-91 easy suggestion for EZ Anthony
Edwards@northsta (499+0)

> I just have a suggestion:  when I iconify an Ez window, I get a huge
> file name in a box as the icon.  The huge file name is because we're on
> NAFS which means all our directories start with at least
> /afs/northstar.dartmouth.edu/user/... 

Are these long filenames present even when editing files under your home
directory?  Here a tilde (~) is used to represent my home directory. 
That makes the icon string reasonable for my most common editing tasks.  

What does the user community think about this issue?  Is a new
preference called for?  *.ShortIconNames: YES

Gary Keim
ATK Group

janssen@parc.xerox.com (Bill Janssen) (01/29/91)

Excerpts from ext.andrew: 28-Jan-91 Re: easy suggestion for EZ Gary
Keim@andrew.cmu.edu (1346+0)

> What does the user community think about this issue?  Is a new
> preference called for?  *.ShortIconNames: YES

I've modified my xim so that it controls both titles (which I like to be
as long as possible) and icons (which I like short) more precisely.  The
preference MaxTitleLength is either the max number of chars to put in
the title line, or -1 if no max is desired (as long as possible).  Same
for MaxIconLabelLength.  Finally, it is per-application selectable
whether to use the name of the application in the title line, via
UseProgramNameInTitle.  Here's an excerpt from my preferences file:

    typescript.MaxIconLabelLength:      20
    typescript.MaxTitleLength:  -1
    typescript.UseProgramNameInTitle:   yes
    ez.MaxIconLabelLength:              20
    ez.MaxTitleLength:          -1
    ez.UseProgramNameInTitle:   no

Here's my version of SetWMProperties (from xim.c):

    static void
    SetWMProperties(self, nameChanged)
    struct xim *self;
    boolean nameChanged;
    {
        Window leader = self->groupLeader;
        Display *display = xim2display(self);
        Window window = xim2window(self);
        char *WMName, *iconname;
        int lengthName;
        int lengthTitle;
        int lengthWMName;
        char *name = im_GetProgramName();
        char *title = xim_GetTitle(self);
        XWMHints *wmhints, *hints, myhints;

        if (nameChanged) {

        XClassHint programClass;

        programClass.res_name = name;
        programClass.res_class = "atk";
        XSetClassHint(display, window, &programClass);
        }


        if (useProgramNameInTitle && name != NULL)
        lengthName = strlen(name);
        else
        lengthName = 0;

        if (title != NULL)
        lengthTitle = strlen(title);
        else
        lengthTitle = 0;

        if (titleMaxLength > 0 && lengthTitle > titleMaxLength)
        lengthTitle = titleMaxLength;

        WMName = (char *) malloc (lengthName + lengthTitle + 2);

        bcopy(name, WMName, lengthName);
        WMName[lengthName] = ' ';
        bcopy(title, WMName + lengthName + 1, lengthTitle);
        WMName[lengthWMName = lengthName + 1 + lengthTitle] = (char) 0;

        XStoreName(display, window, useProgramNameInTitle ? WMName :
    WMName + lengthName + 1);
        if (iconMaxLength > 0 && lengthWMName > iconMaxLength) {
        WMName[lengthWMName - iconMaxLength] = '.';
        WMName[lengthWMName - iconMaxLength + 1] = '.';
        iconname = WMName + lengthWMName - iconMaxLength;
        }
        else
        iconname = WMName;
        XSetIconName(display, window, iconname);

        if ((wmhints = XGetWMHints (display, window)) == NULL)
        {
        hints = &myhints;
        hints->flags = 0;
        }
        else
        hints = wmhints;
        hints->flags |= StateHint;              /* try to make expose
    work -wjh */
        hints->initial_state = NormalState;
        hints->flags |= InputHint;
        hints->input = TRUE;
        if (leader != 0)
        {
        hints->window_group = leader;
        hints->flags |= WindowGroupHint;
        }
        XSetWMHints(display, window, hints);
        if (wmhints != NULL)
        XFree (wmhints);
        if (leader != 0) {
        int argc;
        char **argv;

        if (nameChanged) {
            char buf[500];

            sprintf (buf, "Andrew window-group leader for %s (process %d)",
                     name, getpid());
            XStoreName(display, leader, buf);
        
            buf[0] = (char) 0;
            gethostname(buf, sizeof(buf));
            XChangeProperty(display, leader, XA_WM_CLIENT_MACHINE, XA_STRING,
                            8, PropModeReplace, buf, strlen(buf));
        };

        argv = application_GetRestartArgs(&argc);
        XSetCommand (display, leader, argv, argc);
        }
    }

There is code in xim__InitializeClass to actually read the preferences:

        iconMaxLength = environ_GetProfileInt ("MaxIconLabelLength", 10);
        titleMaxLength = environ_GetProfileInt ("MaxTitleLength", -1);
        useProgramNameInTitle =
    environ_GetProfileSwitch("UseProgramNameInTitle", FALSE);

Note also that my xim struct has a slot for window group leader, and
that I put all windows from a particular process in a single window
group, on which I place the appropropriate X11 ICCCM properties for
restart.

Now to go in and take that code out of typescript that limits the title
length...

Bill

tobeye@NORTHSTAR.DARTMOUTH.EDU (Anthony Edwards) (01/30/91)

Excerpts from internet.info-andrew: 28-Jan-91 Re: easy suggestion for EZ
Gary Keim (1346+0)

> Are these long filenames present even when editing files under your home
> directory?  Here a tilde (~) is used to represent my home directory. 
> That makes the icon string reasonable for my most common editing tasks.  

For me, I get long file names because we edit our source code in a
different account than our user id, ~source.  At the moment, I see one
of my Ez windows reads
	---user/source/src/northcalc/nc_graf.c
Yes, a ~ appears when I'm in my home account, but even then, the above
file name would appear as
	~/src/northcalc/nc_graf.c
which I consider longer than I want.

I like Bill Janssen's idea of having a long name for the title bar and a
short name for the icon.  (I have nothing against long names when
there's space for them, but when I iconify the window, I'm doing so to
minimize the amount of screen real estate that window uses.)

   - Anthony

kriso@NORTHSTAR.DARTMOUTH.EDU (Kris Olander) (01/30/91)

What I'd like to see is some preference/Xdefault like:

*.IconShortTitles: on
*.TitleBarShortTitles: on

to apply to any app that might wish to display a filename inside an
icon or a title bar respectively. :)

I would think that this wouldn't be too difficult to implement and
would make ATK even more configurable.


-Kris Olander

gk5g+@ANDREW.CMU.EDU (Gary Keim) (01/30/91)

Excerpts from misc: 28-Jan-91 Re: easy suggestion for EZ Bill
Janssen@parc.xerox. (4009+0)

> The preference MaxTitleLength is either the max number of chars to put
> in the title line, or -1 if no max is desired (as long as possible). 
> Same for MaxIconLabelLength.

I'd like it better if the preference was something like
MaxTitlePathElements and MaxIconPathElements.  Simply specifying the max
number of characters will result in truncated pathnames that may be
ugly.  I haven't compiled your version of SetWMProperties(), so maybe
I'm confused about how the labels will appear.

-Gary

janssen@parc.xerox.com (Bill Janssen) (01/30/91)

Excerpts from ext.andrew: 29-Jan-91 Re: easy suggestion for EZ Gary
Keim@andrew.cmu.edu (584+0)

> I haven't compiled your version of SetWMProperties(), so maybe I'm
> confused about how the labels will appear.

Something like this:

[An Andrew ToolKit view (a raster image) was included here, but could
not be displayed.]

On top is an iconified typescript, current directory
/tilde/janssen/projects/andrew/linkbutton.  Below that is a
non-iconified typescript, current directory
/r4a/ams/macmail-server/snap2/hdrs/.  Below that is a non-iconified EZ
window, on the file /tmp/foo.

Bill

james@ENGRSS2.UNL.EDU (James Nau) (01/31/91)

Just to add more confustion, how about adding options to the
proposed *.ShortIconNames so that it could take values:

yes:  always strip off path
no:   never strip off path (or add ~ maybe?)
user: always try to append ~user/ if it's in some users directory
      or ~/ for user's home directory
      (for you, it'd be likely ~source/...)


> What I'd like to see is some preference/Xdefault like:
> 
> *.IconShortTitles: on
> *.TitleBarShortTitles: on
> 
> to apply to any app that might wish to display a filename inside an
> icon or a title bar respectively. :)
> 
> I would think that this wouldn't be too difficult to implement and
> would make ATK even more configurable.
> 
> 
> -Kris Olander

When my window manager (motif on AIX 3.1) iconifies, it always is a
rectangle of the same size, and the icon title is truncated on the
right.  When I move my cursor into the icon, then the title expands
to whatever size it needs.  I assume that twm does not do this (It's
been tooo long since I've used twm)?

I do like the idea of having the icon title separate from the titlebar
text (loosely coupled, I guess).

James Nau
james@engrs.unl.edu

tpn+@ANDREW.CMU.EDU (Tom Neuendorffer) (02/01/91)

Excerpts from mail: 31-Jan-91 Re: easy suggestion for EZ Anthony
Edwards@northsta (611+0)

> Looking at your raster of your typescripts begs the question:  how do
> you get the current working directory in the titlebar of a Typescript
> window?  I've never seen this before and didn't see any mention of it in
> the documentation.

I have to plead guilty to this one. Some things aren't documented
because they are just such incredible hacks. But some very useful things
just aren't possible without such hacks. To get the current directory in
the typescript title bar, you can put the following lines in your .cshrc
(assuming you use csh). I have run this way for years without problems,
except some occasional confusion when running shell script that change
directories. Note that the \001 and \002 below have to  be replaced with
control-A and control-B before this will work. Have fun. 

	Tom N.

    if ($term == wm) then
        alias cd 'cd \!* ; set prompt="$cwd:t> "; echo -n \001$cwd\002'
        alias pushd 'pushd \!* ; set prompt="$cwd:t> "; echo -n \001$cwd\002'
        alias popd 'popd \!* ; set prompt="$cwd:t> "; echo -n \001$cwd\002'
        set prompt="$cwd:t> "
        echo -n \001`pwd`\002
    else
        alias cd 'cd \!* ; set prompt="$cwd:t> "'
        alias pushd 'pushd \!* ; set prompt="$cwd:t> "'
        alias popd 'popd \!* ; set prompt="$cwd:t> "'
        set prompt="$cwd:t> "
    endif

ghoti+@ANDREW.CMU.EDU (Adam Stoller) (02/01/91)

Once you've added what Tom posted, to your .cshrc (and sourced it) - you
make use of several nice proctable functions for command completion and
such:

Proctable Entry (literal argument)
- Description
- Sample binding


fcomp-complete-filename (typescript)
- Filename completion
- addkey fcomp-complete-filename ^I (typescript)
    it took me a little while to get used to not being able to use
    an actual tab in typescript - the occasion for when I want to
    comes up so rarely - and I can always do ^X^Q^I to inesrt one if
    need be.

fcomp-possible-completions (typescript)
- Display possible filename completions
- addkey fcomp-complete-filename ? (typescript)
    It took a bit longer to get used to not being able to use ? in
    typescript, but not much longer, and as with tab, I can always
    type ^X^Q? in order to get a question-mark when I really want it.


THESE NEXT TWO MAY NOT YET BE IN THE CURRENT RELEASE OF THE TOOLKIT -
they are substitute proctable entries related to an underlying change
made to typescript (which, as I said, may not yet be released) -
allowing the traversing of your history of commands - even after the
typescript has been cleared - based on an intial part of the command
string.  They take a little while to get used to also - especially if
you used the old functions a lot - but I don't think it takes too long
to discover that they're better than sliced bread.....

fcomp-complete-command-backward (typescript)
- Complete partial command - searching backwards
- addkey fcomp-complete-command-backward \e= (typescript)
    (Escape Equals)

fcomp-complete-command-forward (typescript)
- Complete partial command - searching forwards
- addkey fcomp-complete-command-forward \e` (typescript)
    (Escape Backquote)


Obviously the above are example bindings - you can always set your own
bindings for them in your ~/.atkinit file.

--fish