FW: [devlearning] Having trouble with first global plugin




From: devlearning@nvda.groups.io <devlearning@nvda.groups.io> On Behalf Of Nolan Darilek
Sent: Thursday, January 5, 2023 2:05 PM
To: devlearning@nvda.groups.io
Subject: [devlearning] Having trouble with first global plugin


Hey folks, hope this is the right place to ask about NVDA addon development. I couldn't tell if this was for general development with NVDA, or specifically for making addons.

Let me first describe what I'm trying to do in case I'm going about it the wrong way. I'm trying to get NVDA working on the Steam Deck, a gaming tablet with Windows support. Right now I still need the keyboard for some things, but my goal is to play most games (including those requiring OCR) with nothing but the touchscreen and on-device hardware game controls.

My current issue is that I can't exit an existing OCR result with the touchscreen only. Maybe there's already a way to do this, but right now I'm using the escape key on a connected keyboard. I thought that the way to do this would be an addon that binds a script to send the escape key when a touchscreen gesture is triggered, but either I'm doing it wrong, or the method for exiting an existing OCR result can't be spoofed by sending an escape keyboard gesture. Here's my current code in the scratchpad directory. I'm using tones to demonstrate that the script is running correctly.

import globalPluginHandler

import keyboardHandler

import scriptHandler

import tones

class GlobalPlugin(globalPluginHandler.GlobalPlugin):


        description="Emulate escape",



    def script_emulateEscape(self, gesture):


        tones.beep(440, 1000)

The tone plays, but I still can't exit OCR results. I also see nothing in the logs when this triggers, so either there's no error or it isn't getting logged for whatever reason.

Am I doing this wrong? Or is the method for programatically exiting an OCR result different than sending an escape?

Or, even better, is there already some way to do this and I don't need an addon? :)