Any way to change LXTerminal window title to current job?

LXTerminal is the standard terminal emulator of LXDE - http://wiki.lxde.org/en/LXTerminal
Locked
YAOMTC
Posts: 6
Joined: Sun Feb 21, 2010 5:49 am

Any way to change LXTerminal window title to current job?

Post by YAOMTC »

If I have two terminal windows up, I can't tell them apart on the taskbar unless I remember which I started first or if I hover over it. How can I make it so the titles of LXTerminal windows show the current job? Like if I run synergyc, it'll say so in the title.
maces
Posts: 503
Joined: Sat Oct 25, 2008 6:04 pm
Contact:

Re: Any way to change LXTerminal window title to current job?

Post by maces »

Hi,

Which version of LXTerminal are you using? Mine (0.1.9) can do it, by "right click>assign title".

maces
YAOMTC
Posts: 6
Joined: Sun Feb 21, 2010 5:49 am

Re: Any way to change LXTerminal window title to current job?

Post by YAOMTC »

I meant I want the terminal's title to be changed automatically.

I found something relevant about bash in a comment on the Macworld forum:

http://hints.macworld.com/article.php?s ... 3233857363
Use 'precmd' and 'postcmd' in tcsh
Authored by: Viridian on May 24, '02 09:29:02PM

robg has stated his preference for an alias that puts the current job in the title bar using the 'postcmd' variable, but when I put directory info in the alias, I noticed that when I changed directories, it would display the directory I had just left, not the one I was in, until I entered another command or pressed Return. After much experimentation, I found that setting both the 'precmd' AND 'postcmd' variables did what I wanted.

alias precmd 'echo -n "^[]0;"`date "+%H:%M:%S"`" ${cwd}^G"'
sched +0:00 alias postcmd 'echo -n "^[]0;`date "+%H:%M:%S"` ${cwd} => \!#^G"'

[Note: there are three spaces for separation after the back-quoted 'date' command in both aliases.]
They both echo the current time (as a time stamp) and working directory, but the 'postcmd' alias also echoes the current job. Here's an example of what they do:

When a Terminal window is opened, the title bar displays the time and home directory:

19:04:21 /Users/<username>

Navigate to ~/Library/init/tcsh:

19:07:41 /Users/<username>/Library/init/tcsh

Edit aliases.mine:

19:11:32 /Users/<username>/Library/init/tcsh => pico aliases.mine

What's interesting is that all current processes are displayed in the title bar while they are being executed, so on a slow Mac you can make out entire scripts flashing by before your eyes. Talk about dynamic!

On an unrelated note (well, it's about aliases so it's somewhat related), I also use the 'cwdcmd' special variable, which executes on a directory change. I set it to display a brief message and produce a color listing of the directory contents.

Here's how: put the following Perl script (mine is named "cwdmessage") in ~/bin and set its permissions to executable.

#! /usr/bin/env perl

print ("\n\033[37;100mCURRENT DIRECTORY:\033[0m ") ;

Then add these lines to ~/Library/init/tcsh/aliases.mine

alias lx 'ls -F --color' # Assuming you have 'color ls' installed.
alias lc 'ls -GAhlk --color | more' # 'man ls' for options.
alias cwdcmd 'cwdmessage ; cwd ; ls --color' # Put your preferred 'ls' alias here.

Why did I use a Perl script instead of 'echo' ? Because I discovered by accident (complete newbie here) that Perl recognizes ANSI color tags, so I set the message to a different color than normal text. When I change directory, a line is skipped and the message "CURRENT DIRECTORY:"(in white on a dark grey background) is displayed, followed by the directory name and a color listing of its contents.
See my tip about ANSI color codes.

http://www.macosxhints.com/article.php? ... 7085243183

The tcsh man pages are a wealth of information about special variables, and much, much else.[Tip: in the man page type '/' to enter search mode and enter the string you want. Press ctrl-n to skip to the next occurence.]
Locked