Re: [PATCH] xterm titlebar



* Adam Byrtek 'alpha' <alpha student uci agh edu pl> [Thu, 12 Dec 2002]:

Hi !

> A patch to display mc's current working dir in xterm titlebar. I made
> it mostly for my own personal use - I often have many instances of mc
> on my desktop (sometimes shaded, sometimes minimized) and meaningful
> title helps me recognize one that I look for.

Thank you for this patch. My rxvt loves it ! :)

I enhanced it a bit:

    1) The malloced space was never freed. Fixed by replacing
       it with an automatic array.

    2) Home directory portion of the path is converted
       to '~'. It saves space which is valuable in taskbar
       buttons.

    3) FTP passwords are now stripped from the path.

The modified version is attached to this message.

Bye.

-- 
Tomas Styblo <tripie cpan org>
PGP: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC97EA4B6
"People demand freedom of speech as a compensation for
 the freedom of thought which they seldom use." -Kierkegaard
diff -purN mc-4.6.0-pre1/src/main.c mc-4.6.0-pre1.new/src/main.c
--- mc-4.6.0-pre1/src/main.c	Wed Aug 21 03:08:49 2002
+++ mc-4.6.0-pre1.new/src/main.c	Mon Dec 16 03:47:17 2002
@@ -1665,6 +1665,14 @@ make_panels_dirty (void)
     
     if ((get_other_type () == view_listing) && opanel->dirty)
 	panel_update_contents (opanel);
+
+    /* refresh cwd in xterm titlebar */
+    if (xterm_flag && !xterm_hintbar) {
+        char cur_dir[MC_MAXPATHLEN + 1];
+        mc_get_current_wd (cur_dir, MC_MAXPATHLEN);
+        fprintf (stdout, "\33]0;mc: %s\7", strip_home_and_password(cur_dir));
+        fflush (stdout);
+    }
 }
 
 /* In OS/2 and Windows NT people want to actually type the '\' key frequently */


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