(or, life beyond Edit-Preferences)
Joseph M. Brenner, Polymuse Consulting
doom@kzsu.stanford.edu
May 31, 2000
Okay, so being the keyboard junkie that I am, I often close Netscape windows by doing an "Alt w". This however is right next door to "Alt q", which kills all of the Netscape windows, which is not what I want.
I finally decided that enough is enough, so I fixed it. Here's how you do it:
First, find where they stuck the app-default file, and put it into action by copying it to your home directory. This is what worked on my RedHat Linux box:
cp /usr/doc/netscape-common-4.7/Netscape.ad ~/Netscape
Then edit ~/Netscape and change this line:
*confirmExit: FalseTo this:
*confirmExit: True
Now (after restarting netscape) you'll get a rather sensible "Are you you sure you want to exit" message when you do an "Alt q".
However, that wasn't good enough for me, I decided to kill this one completely by changing the mapping of the key that does this pretty useless "exit" function from "Alt q" to "Alt 0" (that is, "alt zero").
To do this, go find the first occurrence of this stuff:
Meta ~Ctrl<Key>Q: xfeDoCommand(exit) \n\
Alt ~Ctrl<Key>Q: xfeDoCommand(exit) \n\
And change it to this:
Meta ~Ctrl<Key>0: xfeDoCommand(exit) \n\
Alt ~Ctrl<Key>0: xfeDoCommand(exit) \n\
And what the hell, you might as well find the second
occurence of it and do the same change over there.
No one uses the Netscape Editor (excuse me,
Composer), but we might as well fix it up too,
while we're at it.
(Note, it is not entirely clear to me what all the "Ctrl<Key>" crap means here, but X Windows keyboard accelerators are a mysterious business... see jwz's entertaining remarks in the comments included in this app-default file.)
And just to be neat, I changed the label in the menu pad:
*menuBar*exit.acceleratorText: Alt+QTo this:
*menuBar*exit.acceleratorText: Alt+0And now, an "Alt q" does nothing, but an "Alt 0" brings up the "do you really wanna?" message.
Note that this barely scratches the surface of the fun and excitement you can have with the Netscape app-defaults file. For example, I also made this change while I was at it:
*reallyQuitMessage: Close all windows and return to the sanity of lynx?
But careful how far you take this, though... one of the troubles with app-default file hacking is that the next time you upgrade your netscape, it's really important to remember to delete this file at the very minimum. Most likely you'll want to replace it with the new version, and manually redo your changes.
And once Netscape 6.0 is out, all bets are off. (I was working with Netscape 4.7 when I worked out this proceedure.)
And just think what chills and excitement you can have with a script such as this:
#!/usr/bin/perl -w
# /home/doom/bin/munge_netscape_ad
# Simple hack that does something silly to Netscape
# app-default files.
# Usage:
# munge_netscape_ad ~/Netscape > ~/Netscape.munged
# mv ~/Netscape ~/Netscape.original
# mv ~/Netscape.munged ~/Netscape
$payload = ", you jerk";
undef $/; # file slurp mode
$file = <>;
while ($file =~ /(^.*?(?:(?!\\).$))/msg) { # chunk by logical lines:
# ignores escaped newlines
$line = $1;
$_ = $line;
# if 1st char is ! or line is blank, then skip it (a comment)
if (/^!/ or /^[ \t]*$/) {
print "$line\n"; # pass it through
next;
}
if (/^\*.*?Message:/) { # if a "Message" then append the payload
# before the trailing punctuation...
s/(.*?)([.,?!](?:\\n)*$)/$1$payload$2/;
}
print "$_\n";
}