Files

293 lines
20 KiB
Plaintext
Raw Permalink Normal View History

Episode: 2054
Title: HPR2054: Blather Configuration Part 1: Desktop Management
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2054/hpr2054.mp3
Transcribed: 2025-10-18 13:47:09
---
This is HPR Episode 2054 entitled Bladder Configuration Part 1, Best Top Management, and is part
of the series Accessibility.
It is hosted by John Kulp and is about 25 minutes long.
The summary is Bladder Configuration Part 1, Best Top Management.
This episode of HPR is brought to you by an honesthost.com.
At 15% discount on all shared hosting with the offer code HPR15, that's HPR15.
Better web hosting that's honest and fair at An Honesthost.com.
Hey everybody, this is John Kulp and Lafayette Louisiana, and today I'm going to do the second
installment of my Bladder series, part of the larger series on Accessibility.
I'll put that away.
I'm in my office at work, and the semester is over, so I don't really expect interruptions,
but there might be some.
I apologize in advance if there are.
The crinkling sound you hear is me unwrapping a brand new one of my $2 microphones.
I bought half a dozen of these things, and I kept one of my bag at all times, and I'm opening
up that one now.
I've got two of them perched on a microphone stand, but it's plugged into my laptop, and
I've got the cables wound all the way around it.
I don't want to try and transfer it.
I've got my regular laptop open over here at the main part of my desk, and then I've got
this.
The one that prompted this series was the one I inherited from a faculty colleague who got
a new laptop, and she gave me this one that's like 10 years old, because it was not running
very well with Windows 7 on it, I guess, and so I wiped that and put Ubuntu, and it's
a Dell Latitude D830.
She says it's about 10 years old.
It seems to run Ubuntu just fine.
It's just the standard, I guess, Unity environment.
I don't know.
I haven't really done any changes to the basic configuration of it, but I've unwrapped one
of my $2 microphones and plugged it into the microphone jack.
In today's episode, I want to just get you guys, if you're following along with this,
started with some basic desktop navigation.
In the first episode, I walked through the process of installing Blather and getting
it to respond to the very first command, the Hello World command, and then today I'm
going to add a few more commands.
First of all, I don't know why I make this Blather, is that the one?
Is it running now?
Hello World.
It's the first command I had.
I can't remember now what the first command was that I wrote.
It's been like a month since I recorded this episode.
Let's see.
Oopsie.
Let me find the Blather configuration file here.
I've got the Genie text editor open.
I'm looking under recent, I don't know, there are no recent files.
Maybe I've never opened it.
Okay.
Sentences.Corpus.
Let's look in the home.config slash Blather commands.com.
There we go.
Yeah.
So why didn't it, Hello World?
Hello World.
There we go.
Okay.
So it's listening.
So right now I have one single command in the commands file and that is the command Hello
World.
Hello World.
It's listening again.
So I'm going to tell it to stop listening just for a moment so that it won't keep saying
Hello World back to me.
So from here you can add as many commands as you want.
I have something like a thousand commands on my main laptop and they do all kinds of things.
Lots of basic desktop navigation, editing commands for the HTML and e-book kind of work
that I do, all kinds of stuff.
Today what I wanted to walk you through was a couple of things.
One is to get the updated, the language updater script in place and working which will greatly
ease the process of adding new commands because every time you add a new command to your
configuration file you have to update the language and dictionary files in order to
have bladder recognize this and then execute the appropriate command.
And when, excuse me, when Jesra first made this program there was no command line way
to do this but I quickly got tired of going to the website and uploading my sentences.corpus
file and having it run its magic in the background and then downloading and then putting the
files in place and Jesra helped me create a curl command that would do all this and then
I wrote a bash script that Jesra has then included in the bladder source files when you
get them from the Git repository you'll get the language updater script with it.
So what we've got to do is put that language updater script somewhere in the path, so I'm
going to go into the bladder source code file and look, okay, there it is.
The language underscore updater.sh is the file we want.
I'm going to do control C to copy that and then go to my home directory where I have
a bin BIN folder and you have to make sure that your home bin folder is also in your path
or else the script will not run when you try to run it without doing a very explicit
path.
So now we need to make sure that it is executable.
Let's open up a terminal here.
I can't tell from the Nautilus file manager whether it's executable or not.
So CD, BIN, list long and yes, it is executable.
There are some values that you can change in the language updater file if you want
to have your stuff in a different place from where it is by default unless you really
know what you're doing, I would suggest not fooling around with that.
So I think the first thing I'm going to do is to add one more eSpeak command just
to kind of make sure that the language updater script is going to work and this is a clever
little command that I have in the other one and it's called Who's the Man?
I spell it HOS because somehow it didn't recognize it anyway.
So what I do is eSpeak and then quotation marks dollar sign, open parenthesis, who am I
close parenthesis, close quote.
So what this does, the way commands are constructed is that it's a key and value pair.
The key is what you want to speak, it's followed by a colon and then after the colon you put
the command you want to be run when bladder hears the key.
So in this one, the key is Who's the Man and the command that's going to be run is eSpeak
and then the result of the command Who Am I?
So what it'll do there is check whoever the logged in user is at the time and it'll speak
that user name.
So I've got the command set up and now I'm going to run the language updater script to
add it to the dictionaries, language updater, let's see if this works.
Okay now I need to start bladder listening again, actually I need to quit bladder out and
then start it back up, bladder does, sure, and let's try it, Who's the Man?
John.
Yes.
Okay now what I'm going to do also, I'm not completely satisfied, it seems a little abrupt
for it just to say John, it's going to say you are comma, Who Am I, the result of whom
it?
Of course since John is the one logged in it says you are John, now this is a way to stroke
your ego I suppose but I give it that flexibility of having a variable there.
Now to make it say the new command, I've just changed it to eSpeak space, open quote,
you are comma space and then the result of dollar sign, open parenthesis, Who Am I?
Close parenthesis, close quote, that's the command now.
To make it run the new command I have to restart bladder and so I'm going to x out of bladder
and then start it up again.
Hello world.
Hello world.
Who's the man?
You are John.
Nice okay so the first attempt at creating a new command, running the language update
or script and trying the new command work perfectly.
So now basically you can just add commands to your heart's content.
One thing that I would probably do if I were going to really be using this computer is
like one of the first commands I would add is the kill bladder command and the restart
bladder command and the update bladder config command.
Incidentally I usually if I have to refer to the program bladder in one of my command keys
I use the word bladder because it just does not understand bladder so people will hear
me say to my computer kill bladder and what I'm trying to do is have it x out of the bladder
program but I just keep talking about bladder all the time so people think that's funny.
But I have one of my frequently used commands if I'm adding a bunch of stuff to the commands
file is update bladder config which will kill the current instance of bladder, run the
language update or script and then restart bladder.
And so that way I don't have to go find the bladder window x out of it and then go to
the terminal and run the language update or script and all that stuff.
However I put a link in the show notes to a sample configuration file since it only
knows two commands right now it's listening and thinking like everything could possibly
be one of those commands and so I didn't I don't think I came even close to saying who's
the man who's the man yeah but it's still responded anyway so I'm going to quit out of bladder
for the moment.
So in the show notes for this episode I put a link to a sample configuration file of
mine that has several hundred commands in it but today for this episode I just want
to talk about some basic desktop management.
These are some of the very first commands that I tried to set up when Jezre first shared
the source code for this program with me.
So what we're going to learn how to do is open up a program, quit that same program and
then switch to that program using voice commands.
I gave an example of a command set it's a three command set in the show notes let me
find it on my other laptop over here and for this one I use Chromium just so how to open
up the web browser how to switch to the web browser when you're in a different program
and then also how to quit it.
So the command that I'm going to use to open it is open Chromium, open Chromium colon
and then the command to be run will simply be Chromium, space, ampersand.
You want to put the ampersand so that it will open that up and then put it in the background.
If you don't do that then it'll sit there waiting for like a really long time and it won't
listen to your next command until you quit out of Chromium, not what you want at all.
So now I'm going to do a second command and call it go to Chromium, you don't have
to use the same speech patterns that I'm using here these are the ones that I like and
so I'm using them.
I think if you use like the default speech commands on Windows you would have to say switch
to Chromium, open Chromium, switch to Chromium, go back.
I find it difficult to say switch to all the time.
It's easier to me to say go to Chromium and so that's what I'm going to do.
And to go to Chromium we have to use the wonderful window management tool called WMCTRL,
window manager control I guess is the long name of that but this is one of the packages
that was installed in the bladder installation script that I talked about in the last episode.
So it should already be all set up on your system.
So the command will be WM, so I've written go to Chromium colon WMCTRL and we want the
A flag, so space dash A and then you give it the window title of the program that you
want to switch to and so in this one I found that you have to put the window title is
going to be Google Chrome and save it.
And then let's go ahead and add the quick Chromium, I wonder if Chromium is even installed
on this laptop.
Maybe I should put Firefox here.
Oh well, it doesn't matter.
One thing you could do is just do the default web browser so I think I'm going to, what
I'm going to do when it says open Chromium colon, I'm going to put x dash www dash browser
and so that way it'll open up the default browser and that might be Firefox.
So I think then when I do go to Chromium, I'm going to do WMCTRL, space dash A, space,
open quote Firefox, close quote, let's see if that doesn't
work.
Of course, that makes no sense at all to say go to Chromium and then have it do Firefox.
So I'm going to say Firefox, this is stupid.
Okay, Firefox and add one more command, quit Firefox, incidentally, here's a pro tip
of using the genie editor like I am, once you have a line like the go to Firefox command,
if you have the cursor positioned in that line and then hit Ctrl D, it will duplicate
that line and then now I've got two lines exactly the same, they both say go to Firefox
followed by that command, now I'm just going to change go to quit, quit Firefox, WMCTRL,
space dash C and that, the C flag closes the window that has the title that's given
here.
Alright, so I've got three new commands, open Firefox, colon, space, x, hyphen, WWW, hyphen,
browser, space, ampersam, that will open whatever the default web browser is.
The next line is go to Firefox, colon, WMCTRL, space dash A, space, open quote Firefox,
closed quote, and then the third command is quit Firefox, colon, WMCTRL, space dash C,
space, open quote Firefox, closed quote.
Now what do we have to do to make these active, we have to run the language update or script,
so I'm going to go back to the terminal, press the up arrow and the last command I ran
was the language update or script, so I'm just going to hit up arrow and then press enter
and it's running and it says it's done.
And you only have a couple of commands like this, the language update or script runs
really fast, when you've got something like a thousand like I have, it takes a little
bit longer.
Okay, so I'm going to go back and restart bladder, bladder, bladder, and I think I've already
got Firefox running here, so I'm going to just try, oops, I've got to hold the microphone
close to my mouth, go to Firefox, yes, I did it, okay, of course you can't hear that
on the podcast, but it switched right to Firefox, now I'm going to see if it will quit Firefox,
it did it, when I said see if it will quit Firefox, it just quit Firefox, now I'm going
to try open Firefox and open it right up, so we've got one, once you've got one application
responding this way to the open switch to and close commands, it's very easy to do the
same thing for all of the desktop applications that you use most frequently.
I have, for example, this for Thunderbird, the email application for the LibreOffice
things, whatever, all you've got to do is figure out what is the command line version
of the command that will open that application, so for example, for LibreOffice, when I say
Open LibreOffice, colon, the command that's run is L-O-F-F-I-C-E space ampersam, that will
open the LibreOffice suite, now I think if you go into slash user slash bin, you can see
what some of these short commands are for the big desktop applications, most of the time
it's just going to be the name of the application in all lowercase letters, but sometimes it's
different.
All right, so that's how you can do some very basic opening closing and switching to.
Now sometimes I have an example in the show notes of an application where it's not so easy
to either switch to it or close it because it's got a window title that is always changing,
depending on what's happening in the application.
The example I give is the Clementine music player, and in most media players this happened
with rhythm box as well, and I quit using rhythm box because for some reason it was just
broken on my Debian system and Clementine seems to work, and I like it pretty well, so
I'm using Clementine now, but anyway, they both have this characteristic where the window
title for the application, it starts out as either rhythm box or Clementine when you first
launch the application, but as soon as you start playing a song, the window title changes
to the title of that song, and so in your bladder configuration file, you cannot
simply say WMCTRL space, dash A space, open quote, rhythm box, closed quote, because
it won't find it once that window title has changed, or you know, substitute in Clementine
or whatever.
And so I've given in the show notes an example of how to make it find the application by
looking for the process ID of the media player while it's playing, and so in this case,
I have, essentially you have to write a little script to help it find the right application.
So in the show notes, if you'll go there and look at my open Clementine command is very
simple, it's just open Clementine colon, and then Clementine ampersand, to go to Clementine
or to close it, you have to find the process ID, and so I have the RID, I think I use this
command from when it was rhythm box, RID stood for rhythm box ID, and then I use the P grip
command to find Clementine, and limit it to a process is owned by the currently logged
in user, and then running it through the head command to bring back only the first line.
And then I determined the window name by doing the window, sorry, WMCTRL space dash LP,
which lists the currently open windows, and then I grep for the process ID that I found
in the first step of this script, and once I have found that line, I strip out everything
except the window title that is currently in effect, and then I use that result inside
quotation marks for the final step of that little script, which is WMCTRL space dash
a space open quote, followed by the window title that it found as a result of all these
little scripting things, close quote, and that's it, and then so then when I say go to Clementine
or quit Clementine, it does all of those things lightning fast and then switches to the
application or quits it, it's pretty magical, okay, so one last basic desktop navigation
command that I want to tell you about is one that I use probably more than any other,
and that is my back flip command, this could be called switch back, but what this command
does is it executes a virtual alt plus tab keystroke, and as you know very well, this is the
thing that allows you to switch right back to the previous application you were using.
So I'm going to add to my configuration file here, the words back flip, I like back flip
because it's easy to say and it's kind of fun to say, and also because it seems to recognize
that word sequence better than recognizing the switch back sequence that I used to use.
So for this I'm going to use the XDO tool package and do the command XDO tool key, so XDO
tool space, and then the word key, k-e-y, space, a-l-t plus symbol, and then capital T, oops,
I pushed inner by accident, capital T, a-b. So what this is going to do, when here's the
words back flip, it's going to execute virtual keystrokes alt plus tab, and now that I've
got that in the commands configuration file, and I saved it, I'm going to quit out of
blather, and then go back to the terminal, run the language update or script again, and
now restart blather. And now I should be able to use this command. Okay, let's try a
few of these, hello world, who's the man, go to Firefox, back flip, and it did, it went
right back to the previous window. Alright, so I think that's probably enough for today,
but that gives you an idea, if you have started using blather and are like right in lockstep
with me at this point, you can start taking off and adding all kinds of desktop management
commands now to suit whatever applications you like to use. Alright, I will talk to you
guys later. Bye-bye.
You've been listening to Hecker Public Radio at Hecker Public Radio dot org. We are a community
podcast network that releases shows every weekday Monday through Friday. Today's show, like
all our shows, was contributed by an HPR listener like yourself. If you ever thought of recording
a podcast, then click on our contributing to find out how easy it really is. Hecker Public
Radio was founded by the digital dog pound and the infonomicon computer club, and is part
of the binary revolution at binrev.com. If you have comments on today's show, please email
the host directly, leave a comment on the website or record a follow-up episode yourself,
unless otherwise stated. Today's show is released on the earth. Create a formance,
attribution, share a life, free dot org license.