Episode: 1750 Title: HPR1750: xclip, xdotool, xvkbd: 3 CLI Linux tools for RSI sufferers Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1750/hpr1750.mp3 Transcribed: 2025-10-18 08:48:12 --- This episode of HBR is brought to you by Ananasthost.com. At 15% discount on all shared hosting with the offer code HBR15, that's HBR15. Better web hosting that's honest and fair at Ananasthost.com. Hey folks, John Culp again in Lafayette, Louisiana and today I'm going to talk to you about three command line tools that I use all the time that saved me hundreds of keystrokes a day. Now I've classified this as an episode in the accessibility series and you might think that it would be more appropriate to put it in the command line series, but the reason I put it with accessibility is because that's basically how I use these tools. You may have heard me talk in the past if you've listened to my episodes about Blather, the speech recognition program that Jezram wrote and that I use basically all the time. Blather is a speech recognition tool that you have to configure yourself, every command that Blather executes is one that you have configured in a configuration file. When I first started using Blather, I knew of a few things that would help me navigate around the desktop like the WMCTRL, I think that's the command, where it can put focus on different windows and stuff like that, but fairly early on I also found that you can use certain commands to type virtual keystrokes and this is when the magic really started to happen with Blather. Once you have harnessed the power of virtual keystrokes it's incredible how many things you can do with your voice. So the commands I'm going to talk about are XDO tool, that's XDO TOL XV KBD, I guess that would be X Virtual Keyboard, would be the long name, XV KBD, and finally XClip. So XDO tool and XV KBD are both commands that can do virtual keystrokes and XDO tool actually can do virtual mouse clicks as well. XClip is command line access to the clipboard which was crucial to a whole lot of the tricks that I use when I'm configuring Blather to do the various tasks that I need. So one of the basic things you can do with XV KBD is just type words or type any characters and you can do this with XDO tool and I have after experimenting with both of them decided that I have different uses for each of them. With XDO tool I normally use that to do simple keystrokes like if I want to do a virtual control plus C to copy some text to the clipboard I will use XDO tool. If I want to type a whole bunch of text or do a really long series of keystrokes I use XV KBD because it seems like it executes faster. Especially if there's a whole lot of text it executes quite a lot faster and so those are the two ways I use that one. But you might want to go look at the show notes if you're interested in actually trying some of these things out. The command that you have to type to do any of this typing is pretty long with XV KBD. For example to type the words fubar you would have to do the command XV KBD space dash X send event that's all one word space dash secure space dash text space and then you enclose the words fubar in single quotes. So that's a whole lot of keystrokes to simply type two three letter words. Now you'd think well that's not very efficient how could I possibly save keystrokes by doing that. And the answer is that you have to use some other program to trigger all of those things and what I use is my voice. So when I tell it to type something it does all of that for me in the background and I never have to touch the keyboard at all. It's a matter of spending a little bit of time setting up a configuration file and setting up commands in order to save you lots and lots of keystrokes in the future. Now XV KBD can also type the contents of a file. And so I have another command in the show notes that shows how you can use it to type out the commands or to type out whatever is in the file called fubar.text. So that would be XV KBD space dash X send event space dash secure space dash file space and then the file name in quotation marks. In this time I called it fubar.text. And so that will tell it to type whatever is in that file and it can be anything from a couple of words to a very long something. I use that to store frequently used bits of text like my name and address and email addresses that I might need to type into fields in a web browser. And also I save fairly large things like lily pond templates that will have one or two thousand characters in them. And I just have to speak a command. And if my cursor is in a window it will just type everything in that file. Look at the split. And it's really quite magical. Now where this really becomes powerful is when you can combine these virtual keystrokes with the clipboard. And so I use this all the time to edit text. And so I will for example I have one of my commands will take whatever text I have selected and copy that text into the clipboard by using a control plus c command with xdo tool. And then it will take the contents of the clipboard and pipe them out using x clip. Actually I should have mentioned the there are two main commands I use with x clip x clip space dash i will send something into the clipboard and x clip space dash o will take whatever is in the clipboard and pipe it out to standard output. And so in the in the example I was just talking about I would select some text and then speak a command and that would trigger a series of events. The first thing would be to do an xdo tool space control plus c to copy that text into the clipboard. And then I would follow that up with an x clip space dash o to send it out of the clipboard. And then I would send it through the stream editor said that's s-e-d to do whatever manipulations to the text that I need to do. For example one of my commands is called capitalize this. And if I want to capitalize the words that I have selected I say that. And it copies into the clipboard sends it out of the clipboard through said to capitalize every word that was selected. And then sends it back into the clipboard so that it can then be typed out as new text. You I did some experimenting with this and it has to be in the clipboard as the corrected text before you can tell xvkvd to type out the right words. So it's it gets a little complicated I suppose. But you can do things like that very easily if you know a few basic said commands. And I'm going to link also to the famous said one line page at sourceforge.net. There's a page called said one line dot text and it has an incredible collection of said one liners that somebody has put together that has some excellent tricks. So that's one of the ways I use the virtual keystrokes is to do that kind of manipulation of text. I use this all the time either to do that kind of correction like a capitalizing things or making everything upper case or everything lower case. Or I use it also to put various HTML tags around selected blocks of text since I work quite a lot in HTML. And I have voice commands that will do the same kinds of things with lot tech formatting like I can speak something like the command latex bold and it will put the text bf bracket things around the text to make it a bold face in latex or lot tech. I have to say latex or else it won't understand me. Let's see. So another way that I use virtual keystrokes is for navigation on websites or even just around my desktop. But for example in Firefox you can use what they call quick search to find text quickly on a page simply by starting typing. If you're just on a web page and you are in Firefox start typing some text that you want to find on the page by preceding it with either a slash or a single quote depending on whether you want to find any instance of that text or only linked text. So the example that I put in the show notes is for my voice command go to grades. And this is what I use when I'm on Moodle. That's our course management system at the university. And I want to view the grades for whatever class I'm looking at. Now I know that along the left hand column somewhere in the I don't know 50 or 100 links that they have over on the left side one of them is grades. And so what I do is when I speak that command is I send a series of virtual keystrokes to my machine and it starts with a single quote and then the word grades and then a backslash R which is a virtual return key. And so what it does is it searches for any linked text that matches that grades and presses enter once it finds it. And that takes me right to the page with grades. This is extremely powerful. Especially for pages that you visit frequently where you're always having to click on the same links. And sometimes I also will put together a series of keystrokes using combinations of XDO tool and XVKBD to navigate to various things. Basically anything that you can get to by a predictable series of keystrokes can be scripted using these commands. And it's really really wonderful. Now I normally launch all of these things using voice commands but if you're using openbox like I am I don't know how many people use openbox anymore but it's it's what I use. And openbox has a wonderful configuration file called RC.xml and on my system it's located in my home directory in the .config slash openbox slash RC.xml file. And in there you can configure keystrokes to launch commands or open programs or basically do whatever kind of command you want. And so for certain things that I use a lot that I want to be able to launch without speaking I will set up a key configuration. And I give an example in the show notes of how I configured the super key plus in as a Nancy to run one of the scripts that I use all the time on the counterpoint book that I've been working on. So anyway I don't know how much I could say about this other than what I have. I mean other than just to give more examples but essentially you would use this kind of thing just for whatever you need. I need it to do all kinds of editing and text manipulation and navigation around my desktop and on web pages. Other people might need it for other things but it's really incredible the things that you can do once you are able to launch your virtual keystrokes on your computer. So I'm going to give it a try. If you want information about Blather and how to set that up then you might see some of my earlier episodes or my demonstration video on YouTube. I'm going to put as many links as I can and the show notes on this. I think I was running up against the character limit but I'm going to put as many links as I can. I have a script on my paste bin site that will install all of the dependencies and grab the source code for Blather and build the necessary things and put the configuration files in the right place on your system if you're running Debian. For other systems I don't know. If you run Arch it's actually very easy because I think Jes were put together a an Arch package build that will do everything for you and get you up and running if you wanted to try that kind of thing with the voice commands. All right I should stop rambling now but anyway I hope you've enjoyed hearing about XClip XDO tool and XV KBD. I don't know if these things come pre-installed on your system but if you're on limits you should be able to get them very easily with a command to get them from your repositories. All right that's it. Take care. Talk to you later. You've been listening to Hacker Public Radio at Hacker Public Radio. 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. Hacker Public Radio was found by the digital dog pound and the infonomicon computer club and it's part of the binary revolution at binwreff.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 status. Today's show is released on the creative comments, attribution, share a light 3.0 license.