a solution for high and dry xterm_title

While happily running mc-4.6.0pre2 on solaris-9-x86 - appreciating the new
xterm_title function, I couldnt help but notice that after I exit from mc the
xterm title was left high & dry where mc was last performing.

I'm envoking this tiny c-prog from .bashrc to return the xterm_title to something suitable:

Here's the line in my .bashrc at the end of the 'mc-pwd' function:

   if [ "$SESSION_SVR" != "" ]
       then echo "$USER $SESSION_SVR" | xterm_title_command
       echo "$LOGNAME $HOSTNAME" | xterm_title_command

and the source for  xterm_title_command.c  :

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>

/* Set text in the xterm title from command line */
update_xterm_title (void)

 char title[50];

 fprintf (stdout, "\33]0;%s\7",title);
 fflush (stdout);

int main (void)
 update_xterm_title ();

and, what the hek, here's the full mc .bashrc stuff:

alias m='mc-pwd'

mc-pwd ()
   /usr/local/bin/mc -c -P "$MC_CWD_FILE" "@$"
   if test -r "$MC_CWD_FILE"; then
       MC_CWD="`cat $MC_CWD_FILE`"
       if test -n "$MC_CWD" && test -d "$MC_CWD"; then
       cd "$MC_CWD"
       unset MC_CWD
   rm -f "$MC_CWD_FILE"
   unset MC_CWD_FILE
   if [ "$SESSION_SVR" != "" ]
       then echo "$USER $SESSION_SVR" | xterm_title_command
       echo "$LOGNAME $HOSTNAME" | xterm_title_command
export -f  mc-pwd

midnight commander is by far the most-used utility on all of my systems
and I'm psyched to see development continued. It's one of the first things
I install on a new system.  Installed without a snag on solaris-9-x86 - just
use the new /usr/sfw/ tree for gnu/gnome1 libs which are now part of the
standard solaris distribution - or if you have the gnome-2-beta-3 package
installed, autoconf will find gnome-2 libs in /usr/gnome.

btw, I regularly check gnu/gnome mirrors for updated packages, and the new mc
was not anywhere to be seen. I found it rather by chance on:
If there's an mc-devel mailing list I'd like to be on it.

Thanks and I hope this is useful!

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]