Index: script.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/script.py,v
retrieving revision 1.37
diff -u -r1.37 script.py
--- script.py	12 Oct 2006 00:33:47 -0000	1.37
+++ script.py	16 Oct 2006 18:56:04 -0000
@@ -42,6 +42,7 @@
 import braillegenerator
 import debug
 import keybindings
+import orca_state
 import settings
 import speechgenerator
 
@@ -69,6 +70,10 @@
 
         self.listeners = self.getListeners()
 
+        # By default, don't handle events for non-active applications.
+        #
+        self.presentIfInactive = False
+
         self.inputEventHandlers = {}
         self.setupInputEventHandlers()
         self.keyBindings = self.getKeyBindings()
@@ -181,6 +186,14 @@
         Arguments:
         - event: the Event
         """
+
+        # Check to see if we really want to process this event.
+        #
+        processEvent = (orca_state.activeScript == self \
+                        or self.presentIfInactive)
+
+        if not processEvent:
+            return
 
         # This calls the first listener it finds whose key *begins with* or is
         # the same as the event.type.  The reason we do this is that the event
Index: scripts/Evolution.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/scripts/Evolution.py,v
retrieving revision 1.67
diff -u -r1.67 Evolution.py
--- scripts/Evolution.py	29 Sep 2006 17:02:23 -0000	1.67
+++ scripts/Evolution.py	16 Oct 2006 18:56:05 -0000
@@ -29,6 +29,7 @@
 import orca.default as default
 import orca.atspi as atspi
 import orca.input_event as input_event
+import orca.keybindings as keybindings
 import orca.rolenames as rolenames
 import orca.braille as braille
 import orca.orca_state as orca_state
@@ -53,12 +54,12 @@
         - app: the application to create a script for.
         """
 
-        default.Script.__init__(self, app)
-
         # Set the debug level for all the methods in this script.
         #
         self.debugLevel = debug.LEVEL_FINEST
 
+        default.Script.__init__(self, app)
+
         # This will be used to cache a handle to the message area in the
         # Mail compose window.
 
@@ -106,6 +107,48 @@
             input_event.InputEventHandler(
                 Script.sayAll,
                 _("Speaks entire document."))
+
+        self.inputEventHandlers["toggleReadMailHandler"] = \
+            input_event.InputEventHandler(
+                Script.toggleReadMail,
+                _("Toggle whether we present new mail if we not not the active script."))
+
+    def getKeyBindings(self):
+        """Defines the new key binding for this script. Setup the default
+        key bindings, then add one in for toggling whether we present new
+        mail if we not not the active script.
+
+        Returns an instance of keybindings.KeyBindings.
+        """
+
+        debug.println(self.debugLevel, "Evolution.getKeyBindings.")
+
+        keyBindings = default.Script.getKeyBindings(self)
+
+        keyBindings.add(
+            keybindings.KeyBinding(
+                "n",
+                1 << settings.MODIFIER_ORCA,
+                1 << settings.MODIFIER_ORCA,
+                self.inputEventHandlers["toggleReadMailHandler"]))
+        return keyBindings
+
+    def toggleReadMail(self, inputEvent):
+        """ Toggle whether we present new mail if we not not the active script.+
+        Arguments:
+        - inputEvent: if not None, the input event that caused this action.
+        """
+
+        debug.println(self.debugLevel, "Evolution.toggleReadMail.")
+
+        line = _("present new mail if this script is not active.")
+        self.presentIfInactive = not self.presentIfInactive
+        if not self.presentIfInactive:
+            line = _("do not present new mail if this script is not active.")
+
+        speech.speak(line)
+
+        return True
 
     def speakSetupAssistantLabel(self, label):
         """Perform a variety of tests on this Setup Assistant label to see
Index: scripts/gaim.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/scripts/gaim.py,v
retrieving revision 1.23
diff -u -r1.23 gaim.py
--- scripts/gaim.py	29 Sep 2006 17:02:23 -0000	1.23
+++ scripts/gaim.py	16 Oct 2006 18:56:05 -0000
@@ -134,6 +134,10 @@
 
         default.Script.__init__(self, app)
 
+        # We want to handle events if we aren't the active application.
+        #
+        self.presentIfInactive = True
+
     def setupInputEventHandlers(self):
         """Defines InputEventHandler fields for this script that can be
         called by the key and braille bindings. In this particular case,
Index: scripts/metacity.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/scripts/metacity.py,v
retrieving revision 1.16
diff -u -r1.16 metacity.py
--- scripts/metacity.py	15 Sep 2006 01:02:07 -0000	1.16
+++ scripts/metacity.py	16 Oct 2006 18:56:05 -0000
@@ -48,7 +48,12 @@
         Arguments:
         - app: the application to create a script for.
         """
+
         default.Script.__init__(self, app)
+
+        # We want to handle events if we aren't the active application.
+        #
+        self.presentIfInactive = True
 
     def onNameChanged(self, event):
         """The status bar in metacity tells us what toplevel window will be
