Este é um script que escrevi há muito tempo, ainda em uso hoje, para modificar sua
* n * x barras de título na mosca. Eu ainda não descobri como mudar
perfis na mosca. Talvez isso ajude embora. Este roteiro deve ser intitulado wlabel para funcionar melhor. Veja exemplos
#!/usr/bin/perl
## Copyright (c) 1995, Tim McCoy, Santa Barbara, CA 93111
## Free use and distribution is granted. Please retain Credits & history
## hplabel (Original name. So named because it was originally created
## for hpterm windows; later modified for sun and linux)
## V 1.0 simple perl script to change an hpterm, xterm, or openlook title
## and icon name to the current directory or as offered on command line.
## V 1.1 Add dtterm, same as xterm (Thanks to Bill Bennett HP-USA)
## V 1.2 renamed to wlabel for Company/personal use.
## V 1.3 Added environmental variable THISWINDOWLABEL detect to retain
## a window variable regardless of movement 5/1/2000 TAM
## V 1.4 Finally got around to testing openlook; it doesn't work. Commented
## V 1.5 Fix for openbook supplied by Bill Wagner (ecad.rsc.raytheon.com)
## V 1.6 Cool one line addition to permit/use backticks in THISWINDOWLABEL syntax
&usage if ("@ARGV" =~ /\-[(h|H)]+/);
# print "@ARGV\n";
use Cwd;
my $cwd = &cwd();
$text = (@ARGV) ? "@ARGV" : ($ENV{THISWINDOWLABEL}) ? $ENV{THISWINDOWLABEL} : $cwd ;
$text =~ s/\n//g; # avoid chomp by converting '\n' to nil (why ??)
$text = '/bin/echo "$text"' if ($text =~ /\'/); # cool one line change
chomp $text;
exit if (! $text);
## print STDERR "text='$text' cwd='$cwd'\n";
$term = $ENV{"TERM"}; # determine term type
if ($term =~ /^(xterm|dtterm)$/i)
{
printf "%c]2;%s%c", 27, $text, 7; # modify the window name
printf "%c]1;%s%c", 27, $text, 7; # modify the icon name
}
elsif ($term eq "hpterm")
{
$len = length($text); # determine length
printf "%c&f0k%dD%s", 27, $len, $text; # modify the window name
printf "%c&f-1k%dD%s", 27, $len, $text; # modify the icon name
}
elsif ($term =~/^(openlook|sun-cmd)$/i)
{
printf "%c]l%s%c\", 27, "$text", 27 ; # modify the window name
printf "%c]L%s%c\", 27, "$text", 27; # modify the icon name
}
## This script doesn't need anything else but I use the following alias
## to automatically generate my location to the current window.
## alias cd 'cd \!* ; wlabel'
sub usage
{
print '
Simple little script to put the current working directory in
the window banner and icon titles. Replaces the useless
"Terminal" or "Xterm" text to useful information. When used
with a cd alias, it performs this function automatically.
usage: wlabel [{string}]
Without arguments wlabel generates the current working directory
name into the banner/icon. When followed by a plain text string
the string is placed in the banner/icon name. Additionally, if
the environmental variable THISWINDOWLABEL is set to a value then
THAT variables contents will be used for the label. V1.6 adds
permitting backticks in the THISWINDOWLABEL string. (i.e.;
setenv THISWINDOWLABEL '."''hostname':'pwd' 'date +\"%T\"''".'
will yield something like: "myhost:/net/myhome/dir 08:40:07"
examples:
% wlabel
# banner/icon is "/your/current/working/directory"
% wlabel verilog
# banner/icon is "verilog"
% setenv THISWINDOWLABEL "common window"
# banner/icon still says "verilog"
% wlabel
# banner/icon is "common window"
bugs:
Telnet windows to other machines will NOT update the banners.
In fact if the cd alias (described below) is used during a telnet
session it may generate errors if the wlabel utility is not in the path.
( If so then just "unalias cd" )
alias:
put this alias in your .cshrc file to automate wlabel:
% alias cd "cd \!* ; ~/bin/wlabel";
And, if the icon text does NOT expand to the full label name when
the cursor passes over it, try adding this to your .Xdefaults file:
Dtfile*desktopIcon: large
I think this is the one I set to make it work right. (TAM 7/3/01)
';
exit 0;
}