[PATCH] xterm titlebar

Adam Byrtek 'alpha' alpha at student.uci.agh.edu.pl
Thu Dec 12 15:58:07 UTC 2002


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.

DISCLAIMER: This patch is probably bad for you, Pavel. It works, but I
don't say its elegant or applied in a good place.

Regards

-- 

  _.|._ |_  _.    : Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|    : gg 1802819, pgp 0xB25952C0
     |            : jid alpha.jabberpl.org
-------------- next part --------------
Index: main.c
===================================================================
RCS file: /cvs/gnome/mc/src/main.c,v
retrieving revision 1.263
diff -u -r1.263 main.c
--- main.c	8 Dec 2002 04:16:30 -0000	1.263
+++ main.c	12 Dec 2002 15:50:02 -0000
@@ -1679,11 +1679,21 @@
 static void
 make_panels_dirty (void)
 {
+    char *d;
+   
     if (cpanel->dirty)
 	panel_update_contents (cpanel);
 
     if ((get_other_type () == view_listing) && opanel->dirty)
 	panel_update_contents (opanel);
+
+    /* refresh cwd in xterm titlebar */
+    if (xterm_flag && !xterm_hintbar) {
+	d = g_malloc (MC_MAXPATHLEN + 1);
+        mc_get_current_wd (d, MC_MAXPATHLEN);
+        fprintf (stdout, "\33]0;mc - %s\7", d);
+        fflush (stdout);
+    }
 }
 
 /* In Windows people want to actually type the '\' key frequently */


More information about the mc-devel mailing list