dictation-toolbox / dragonfly

Speech recognition framework allowing powerful Python-based scripting and extension of Dragon NaturallySpeaking (DNS), Windows Speech Recognition (WSR), Kaldi and CMU Pocket Sphinx
GNU Lesser General Public License v3.0
383 stars 75 forks source link

Incorrect platform check for AT-SPI accessibility controller #361

Closed drmfinlay closed 2 years ago

drmfinlay commented 2 years ago

CC @wolfmanstout

The following platform check for using the AT-SPI accessibility controller on Linux seems somewhat incorrect to me: https://github.com/dictation-toolbox/dragonfly/blob/118defba2d90dfc1b21b388850e998e1735241f2/dragonfly/accessibility/__init__.py#L11-L13

My understanding is that AT-SPI is supposed to work on "Free Desktop" environments, e.g. GNOME. This means that while the software runs on Linux distributions, it will also run on a BSD system or in an environment like Cygwin on Windows.

To be in line with the rest of the library, this should be changed to check whether the XDG_SESSION_TYPE environment variable is set. (I think Wayland may support AT-SPI.) I'll also move this above the Windows platform check as I am doing elsewhere.

wolfmanstout commented 2 years ago

Thanks Dane for digging into this. I didn't put much research into these lines: basically I was supporting what I had tested which was only Windows and Linux. So what you describe makes sense and sounds better!

drmfinlay commented 2 years ago

Hi James,

Checking for Windows or Linux is fine in most cases, of course. I'll make the change and adjust the documentation page appropriately.

I hope to open a separate pull request with a few minor changes to the accessibility sub-package.

drmfinlay commented 2 years ago

As mentioned in #362, the variable mentioned above is unreliable. I'll check for DISPLAY instead.

I could also add a check for WAYLAND_DISPLAY, although I'm not sure if there's much point. If there is someone really interested in that, they can get in touch.