gecko-dev/extensions/xmlterm/scripts/menuhack
svn%xmlterm.org f3b81d69c9 --NOT PART OF DEFAULT BUILD--
XMLterm changes only. Implemented chrome overlay a la Chatzilla to insert
XMLterm into the Tasks menu. Also implemented command line option "-terminal"
and URL handler "telnet://" to invoke XMLterm.
2000-07-07 14:44:26 +00:00

43 lines
1.4 KiB
Perl
Executable File

#!/usr/bin/perl
# menuhack: Modifies the tasks menu to insert XMLterm as a menu item
# Execute in the mozilla "package" directory
#
# NOTE: ** This is temporary hack until the chrome registry becomes
# available. Do not use it if you build mozilla yourself, as it
# messes up the important "tasksOverlay.xul" file.
# (Unless you know what you are doing, of course, in which case
# you may execute it in your "mozilla/dist/bin" directory.)
# Usage: menuhack
use Cwd;
# Locate taskOverlay.xul file
my $dir = cwd();
($dir =~ m%.*/(package|dist/bin)%) or
die "menuhack: Please execute in the package or dist/bin directory\n";
chdir "chrome/global/content/default"
or die "menuhack: Directory chrome/global/content/default not found\n";
my $menufile = "tasksOverlay.xul";
# Insert XMLterm menu item into file
open INFILE, "<$menufile" or die "menuhack: Unable to read $menufile\n";
open OUTFILE, ">$menufile.new" or die "menuhack: Unable to create $menufile.new\n";
while (<INFILE>) {
print OUTFILE unless m/XMLterm/;
if (s%(.*)"&editorCmd.label;"(.*)"toEditor\(\);"%$1"XMLterm" $2"window.open('chrome://xmlterm/content/xmlterm.xul','_blank','chrome,dialog=no,resizable');"%) {
print OUTFILE;
}
}
close INFILE;
close OUTFILE;
rename $menufile, "$menufile.bak";
rename "$menufile.new", $menufile;
print "Modified tasksOverlay.xul to display XMLterm item\n";