Overview
App Modules allow you to improve NVDA’s support for specific applications. When an application is running, NVDA automatically loads the corresponding app module and unloads it when the application closes.App modules are perfect for adding application-specific functionality, customizing how NVDA presents information from an application, or fixing accessibility issues in specific programs.
Basic App Module Structure
App modules must:- Be placed in the
appModulesdirectory - Be named after the application’s executable (e.g.,
notepad.pyfor notepad.exe) - Define a class called
AppModulethat inherits fromappModuleHandler.AppModule
Naming App Modules
Standard Naming
For most applications, name your app module file after the executable:notepad.exe→notepad.pyexplorer.exe→explorer.pyfirefox.exe→firefox.py
Custom Mapping
For executables with names that conflict with Python naming rules or when you want to map multiple executables to one app module, use a global plugin to register the mapping:registrationPlugin.py
Handling Events
App modules can respond to events that occur in their application. Events are methods namedevent_eventName.
Common Events
method
Object gained keyboard focus
method
Object lost keyboard focus
method
Focus moved inside a container object (the object is an ancestor of the focus)
method
Object became the new foreground/active top-level object
method
Object’s name changed
method
Object’s value changed
method
Object’s state changed
method
Caret (insertion point) moved within the object
Creating Scripts
Scripts are commands that users can execute via keyboard shortcuts. Use the@script decorator to define scripts:
scripts.py
Script Decorator Parameters
str
required
User-visible description shown in Input Gestures dialog
str
Category to group similar scripts (defaults to “Miscellaneous”)
str
Single gesture string (e.g.,
"kb:NVDA+shift+v")list[str]
Multiple gesture strings
bool
default:"False"
Whether script applies to focus ancestor objects
bool
default:"False"
Run script even when input help is active
bool
default:"False"
Allow script to run when sleep mode is active
App Module Properties
Essential Properties
properties.py
Sleep Mode
Sleep mode disables NVDA in an application, useful for self-voicing applications:sleepMode.py
NVDA+Shift+S.
Customizing NVDA Objects
App modules can customize how NVDA Objects behave for specific controls:customObjects.py
Hosted Apps
Some executables host multiple apps (e.g.,javaw.exe, wwahost.exe). For these, you need to:
- Name the app module after the hosted app’s internal name
- For
wwahost.exe, inherit from thewwahostapp module
UIA Handling
Control whether to use UI Automation for specific windows:uiaControl.py
Practical Example
Here’s a complete app module for a custom application:complete_example.py
Testing
1
Enable scratchpad
Go to NVDA Settings > Advanced and enable the scratchpad directory.
2
Create app module
Place your app module in
%APPDATA%\nvda\scratchpad\appModules\.3
Launch application
Start the target application.
4
Reload plugins
Press
NVDA+Control+F3 to reload without restarting NVDA.5
Test functionality
Test your events, scripts, and customizations.
Best Practices
- Use
ui.message()for user feedback - Use
log.debug(),log.info(),log.warning()for debugging - Check
obj.roleandobj.windowClassNamefor object identification - Cache expensive computations in instance variables
