mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-14 11:40:13 +01:00
43 lines
1.4 KiB
Perl
43 lines
1.4 KiB
Perl
#!/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";
|