Skip to main content

Sysadmin, interested in new technologies, communications, multimedia, accessibility, better Linux than Windows, better Android than IOS and similar.

pvagner

pvdeejay

mastodon.sk/@pvagner

Peter Vágner

Emacs A11y Tip #3: Emacs with speechd-el running on Termux for Android

5 min read

After a long while I am here with another post in my collection of .
This time I am not going to talk about emacs environment with speech as provided by speechd-el, I will try to describe how I have managed to get a lot from emacs on the go while running it on Termux for Android.
My reasoning behind this setup is that Emacs can be run on pretty much any computing device. I have used to carry a RPI 2 with me to have access to basic linux CLI tools and emacs. Now I believe using my phone with external keyboard connected will serve this purpose even better. Additionally after a bit of learning now I can use emacs even with braille touch keyboard as provided by the Corvus access solution for android as it can emulate ctrl and alt keys. Emacs letter based keyboard shortcuts and braille keyboard are perfect fit together.
There appear to be multiple ways on how to run emacs on Android. Up to now I was not aware of a single setup where I can also have speechd-el and its dependencies working on Android in a way so I can make some good use out of it.

I know the title of this article has a lot of things mixed together so before I'll describe the setup I'll at least link to more details about all these things I have mentioned so far.

Android is an operating system that powers your mobile phone or tablet.
Termux is an awesome app for Android that includes powerfull partially accessible terminal emulator and features repository of traditional command line apps similar to most linux distributions. As of this writing termux is returning to google play it can be installed easily again and for running emacs it's more than capable enough.

So here are the steps:

  • Install Termux either from F-Droid or from Google play.
  • Launch termux and use it directly on your device with Talkback running at least to pass this initial setup.
    On first launch termux will show its terminal view and enable the keyboard. While typing on the keyboard keys are directly passed to the app running in the terminal. You can dismiss the keyboard by pressing the device back button and review the terminal view content with your screen reader. You can double tap the terminal view to get the keyboard back if the app running is not consuming the double tap as a click (emacs does this for example). Termux also has an app drawer you can reach by pressing the back button of your device when the keyboard is closed or you can swipe two fingers from the left hand side if screen reader is running (single finger when it's not). On the drawer there is a list of terminal sessions and two unlabelled buttons. First one shows the keyboard, when long pressing it displays extra row of buttons that complement the keyboard such as ctrl key, alt key, arrow keys and similar. These extra buttons are displayed on the bottom part of the screen inside a view pager. Swiping the buttons to the left switches to the second page with the text input view that can be used with all the android keyboard and accessibility specific review capabilities while typing. While emacs is not running on the device I like to type in commands into this input entry field. When this text entry field is empty pressing the enter key also sends the enter key into the terminal view.
    Also don't forget to read termux documentation where it's talking about the touch keyboard and even the hardware keyboard if you have one.
  • Allow termux to read and write to storage by running
    termux-setup-storage
  • Then install ssh daemon on Termux by running these commands into the terminal one after the other paying attention to the output
    pkg update
    pkg upgrade
    pkg install openssh
  • In order to be able to login to Termux via SSH, you need to prepare a private / public key pair on your PC by running ssh-keygen, then transfer public key to termux saving it into ~/.ssh/authorized_keys. See more about running sshd on termux at the Termux wiki.
  • Start ssh daemon on Termux just by running
    sshd
  • If you like you can execute the following steps inside an SSH session from your PC. You can connect to termux via SSH like this
    ssh user@<deviceIP> -p 8022
  • Install speech-dispatcher and emacs along with its dependencies such as needed termux specific packages and espeak
    pkg install speechd emacs
  • Clone speechd-el git repository where emacs can load it
    git clone https://github.com/brailcom/speechd-el.git $HOME/../usr/share/emacs/site-lisp/
  • Test if speech-dispatcher is working by launching
    spd-say "Hello world"
  • If you can hear espeak saying hello world it's all working fine.
  • Now make a symlink so speechd-el can find speech-dispatcher unix socked with no other configuration changes.
    cd && ln -s .cache/speech-dispatcher .speech-dispatcher
  • Configure emacs to start speechd-el by writing this content into the .emacs file for example by using nano a text editor bundled with termux.
    nano $HOME/.emacs
  • Put this content into the file
    (setq speechd-out-active-drivers '(ssip ))
    (autoload 'speechd-speak
    "speechd-speak" nil t)
    (speechd-speak)
  • Finally launch emacs by simply typing in
    emacs

Refer to other to find out more.

 

Peter Vágner

can be made accessible when running under linux. It's just that the working patch has not landed for some 10 years... https://bugzilla.abisource.com/show_bug.cgi?id=4736

Peter Vágner

I've just found out an client terminal view is somewhat accessible. It needs some love though. Anyone to mentor me?

Peter Vágner

@Firefox has became again. Thank you!

Peter Vágner

I love how exposes HTML5 video controls in a video element popup menu. Discoverable, native and accessible!

Peter Vágner

Oooops, for nightly does not work for me at all with . has issues. Web content is not .

Peter Vágner

guys can you please give me some tips on how to do some accessible components with ? e.g. popupmenu, list, listbox...

Peter Vágner

Emacs A11y Tip #2: graphical or pure text console setup

4 min read

In my Emacs A11y Tip #1 I've already touched the topic of this #2 from slightly. I did not explore all the details at the time so I feel I should try to correct this now.
When installing Emacs there are various possible build configurations and some of them have been adopted as a defacto standards meaning analogous packages are available in the multiple linux distributions package repositories. These are emacs, emacs-nox and emacs-gtk2.

Guessing from the package names it's obvious -nox variant has all the graphical dependencies stripped out. That means we will only see text UI when running no matter if we are in a graphical X session or on a text only console. I was expecting full package would therefore be unnecessary for me because it brings in a few more dependencies and the window it presents is inaccessible to orca anyway. So given this reasoning I assumed it might have minimal impact and I won't need X support in my install of Emacs.

My complicated reasoning has proven not to be quite right and X support within emacs might really be usefull. I have found out a few differences between X and no X variants and some of them are serious enough for me to install X support.

  • When X support is installed, emacs kill and copy commands insert the text into the clipboard so it's possible to copy and paste from emacs into other applications and the other way round.
  • No X variant can be also running within a terminal emulator like gnome-terminal. It means you can use orca's flat review to examine its output.
  • When X support is installed Emacs creates its own window seperated from a terminal if emacs is started from a terminal emulator. It is completelly inaccessible to orca and it consumes all the keyboard input so orca even can't receive the insert / capslock key presses. It is possible to decide during runtime when X aware version of emacs is installed if we want / don't want X support. Run
    emacs -nw
    to start emacs with no X support.
  • Installation which also features X support can also be started in pure text only console. In such a case X support won't be used obviously. Emacs should otherwise be as functional as intended. I've found askubuntu answer supporting this argument. Some parts of Emacs appear to inherit native accessibility and I am not sure where this is coming from. For example pressing C-x C-f brings up find interface accessible with Speechd-el but pressing F10 shows up GTK2 based menu bar and activating Open... from the File menu pops up GTK2 native file chooser dialog.
  • emacs-gtk2 has X support and as an addition it also features mixture of its natural UI with some GTK2 based widgets. I don't know if there is something usefull for us here.

Given the fact there is no complete full browser inside Emacs, copy and paste is really essential. Additionally it is possible to configure Emacs to open web links in 3rd party apps so depending if you are in X or not you can configure to open these in Firefox or elinks directly.

There might be other notable differences when running emacs within X session or pure text console for example gpg agent setup or integration with other 3rd party tools. If I find it to be significant enough I will post a new tip.
I don't consider emacs with gtk+2 support particularly appealing just yet because it does not appear to be practical switching between operating system native and emacs specific screen reading app.

Update: Originally I have assumed graphical ATK accessible menu is only within emacs-gtk2, however it's also present in the original emacs with no GTK support. It sounds a bit dissapointing that we have no speechd-el accessible menu in this mode. But using keyboard shortcuts and other things is worth the trade I think.

Update2: Run

emacs -nw

if you would like to decide at runtime whether you do want an X support or not.

Peter Vágner

It appears new alpha is not with screen readers at all.

Peter Vágner

I second the request that you should ensure new pannels are keyboard controllable and the interactive widgets are all properly labeled. Please make it