Overview
Global Plugins allow you to add functionality that works across all applications. Unlike app modules which are specific to one application, global plugins are loaded when NVDA starts and remain active until NVDA exits.Use global plugins for features that should be available everywhere, such as:
- New navigation commands
- System-wide information scripts
- Custom braille features
- OCR functionality
- Cloud synchronization
Basic Global Plugin Structure
Global plugins must:- Be placed in the
globalPluginsdirectory - Have a unique filename that describes their purpose
- Define a class called
GlobalPluginthat inherits fromglobalPluginHandler.GlobalPlugin
Lifecycle Methods
Global plugins have two key lifecycle methods:method
Called when the plugin is loaded (NVDA startup).
method
Called when the plugin is being unloaded (NVDA exit).
Handling Events
Global plugins receive events from all applications and controls. Event methods are namedevent_eventName and take three arguments:
events.py
Event Method Signature
GlobalPlugin
The plugin instance
NVDAObject
The NVDA Object on which the event occurred
callable
Function to call to propagate the event to the next handler. Always call this unless you have a specific reason not to.
Creating Scripts
Scripts are commands bound to keyboard shortcuts that users can execute from anywhere:Script Decorator Parameters
str
required
User-visible description shown in the Input Gestures dialog
str
Category for grouping in Input Gestures (uses plugin’s
scriptCategory if not specified)str
Single keyboard gesture (e.g.,
"kb:NVDA+shift+v")list[str]
Multiple keyboard gestures
bool
default:"False"
Whether the script applies to focus ancestor objects
bool
default:"False"
Run the script even when input help is active
bool
default:"False"
Allow script execution when sleep mode is active
enum
The say all mode to resume after executing the script (from
speech.sayAll.CURSOR)bool
default:"False"
Produce speech when called while speech mode is “on-demand”
Gesture Formats
Gestures identify input that triggers scripts:Customizing NVDA Objects
Global plugins can customize NVDA Objects system-wide:objectCustomization.py
Practical Examples
Example 1: Application Switcher
appSwitcher.py
Example 2: Clipboard Monitor
clipboardMonitor.py
Example 3: OCR Integration
ocrPlugin.py
Example 4: Quick Settings
quickSettings.py
Configuration Management
Global plugins can save and load settings:configuration.py
Threading and Timers
threading_example.py
Testing
1
Enable scratchpad
Go to NVDA Settings > Advanced and enable the scratchpad directory.
2
Create plugin
Place your global plugin in
%APPDATA%\nvda\scratchpad\globalPlugins\.3
Restart or reload
Either restart NVDA or press
NVDA+Control+F3 to reload plugins.4
Test functionality
Test your scripts and event handlers in various applications.
5
Check logs
View NVDA log (
NVDA+F1) for any errors or debug messages.Best Practices
Code Quality:
- Provide clear script descriptions
- Use appropriate script categories
- Log debug information appropriately
- Handle exceptions gracefully
- Test in different NVDA configurations
- Consider internationalization from the start
Common Pitfalls
-
Forgetting to call nextHandler()
-
Not cleaning up in terminate()
-
Blocking the main thread
