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

Editing text with Commentary #ScreenReader on #Android

5 min read

Commentary screen reader is a modern and trendy app for android that adds some inovative and usefull features on the top of the necessary screen reading features.
It's worth noting that as compared to Talkback it is very very responsive and feels snappy.

Lets look at how Commentary screen reader (CSR for short) handles text editing.

Imagine we are writing a message using the Gmail app. We can open the app, locate the Compose button somewhere at the top of the screen, bring up the compose screen, tap message text field in the center of the compose screen. All this is a standard screen reader interaction.
Keyboard such as Google keyboard (GBoard for short) opens and we can begin typing.
Let's write at least two sentences so you have a bit of text to practice editing with.
If you are done typing, touch the text box you have just been typing into. You will receive feetback from CSR stating you can use left and right arrows to navigate over the text.
If you want to make simple changes to your text near the start of your text navigating letter by letter and using backspace key on the keyboard is enough however if you need to edit parts of your text in the middle or near the end of the text it would not be very practical to navigate character by character there.

CSR has an editing entry in the actions menu. So either flick right then up and execute editing from the action menu or flick right then down to open the same editing menu, the choice is yours. It's best to inwoke this after touching or navigating to text box where the editing makes sense. When using the Action menu you can open the editing menu for just any content on the screen even buttons, checkboxes and similar. That way you can review the content, copy parts of it or use it to your heart's imagination, of course editing won't work in that case.
When the editing menu is displayed on the screen it has row of buttons on the bottom and most of the screen space is taken by the list. By using the buttons on the bottom you can configure the list to split the text into characters, words or paragraphs. If you tap the Char button, the list will have as many items as there are characters in your text. If you choose words then the number of items in the list relates to how many words there are in your text. If you choose paragraphs it will split your text by end of line character so wrapped lines don't count. The buttons currently say Char, Sentence and Paragraph. Perhaps that's minor translation discrepancy while translating from chinese to english as the text is clearly divided to the individual words rather than sentences when the Sentence button is pressed.
If you have a large text you can start by splitting that to paragraphs. Find the paragraph you are interested in and reconfigure the list to split text into words if the paragraph is very long and continue navigating word by word just by browsing the list.
When you double tap an entry in the list, only the chosen part of text is shown in a simple text box dialog. This dialog is the most simple dialog you can get. It has a title a text box and OK and Cancel buttons. It only displays your chosen part of the text in the box so you can double tap it and edit it as a simple short text by navigating character by character and deleting using keyboard backspace / delete button.
It is even possible to call editing from this dialog again if you have clever use case for that. So you may use this split editing feature recursivelly and focus on the text you wish to work with. This way it is helping you to prevent accidental keypresses that may introduce typos and other unwanted edits.
This editing menu can split text up to 100 characters in the free CSR version, so if you would like to use it for serious editing you will have to activate the premium version.

It is also possible to work with the text the traditional way when using CSR. There is so called Word by word mode. Actually there are two modes Word by word mode and Focus browsing mode. We can toggle these two modes by swiping left then down.
In focus browsing mode you are navigating from item to item on the screen by swiping either up or down. Left or right swipes can be used to skip a group of items such as scroll to next page, move past a list and similar. This is also working on the web.
In word by word mode up and down swipes move line by line and left or right swipes move a character. When you cross an item boundary for example moving from button to button or out of a text box, CSR beeps or vibrates according to the configured preferences.
There are additional word by word mode specific gestures:
Swipe left then right - Skip to previous paragraph.
Swipe right then left - Skip to next paragraph.
Swipe up then down -
Swipe down then up -
Swipe left then up -
Swipe right then down -

I am not sure what exactly are these four gestures supposed to do. They are moving to the start or to the end of a text. But they are duplicated for a reason I would say.

Feel free to experiment with these features and be sure to discuss how it affects your productivity with your Android device.
The official SCR Telegram group is at https://t.me/jieshuochat