Episode: 4349 Title: HPR4349: xbindkeys send keys for linux! Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr4349/hpr4349.mp3 Transcribed: 2025-10-25 23:28:24 --- This is Hacker Public Radio Episode 4349 for Thursday the 3rd of April 2025. Today's show is entitled Expined Keys Send Keys for Linux. It is hosted by Operator and is about 12 minutes long. It carries a clean flag. The summary is, I talk about my setup with Expined Keys. Hello everyone and welcome to another episode of Hacker Public Radio with your host Operator. Today we are going to be talking about Send Keys, more specifically sending keystrokes and Linux. I have done this in Windows several different ways. You can do it with PowerShell, Calling, you know, VB or something. You can do it with Otohaki, you can do it with Otoit. My familiarity is more with Otohaki, I use it day-to-day, daily, and I also have been known to use PowerShell to send keys in sticky situations that you don't need to actually install anything. It is also not detected by Enterprise or malware. Any bleeding edge EDR tools are not detected either. So anyways, my use case is downstairs, MediaBox, hooked up to a keyboard and mouse remote. That controls, it's complicated, I have one of my episodes talks about my AV setup, but that controls my receiver, receiver, everything is plugged into, and the power button on the remote is turned off the receiver, and then it has a parent-child relationship power strip that turns everything off the TV and everything of the speakers, and all that, it turns all that off when the receiver turns off. The problem is that I stream with Sunshine in Moonlight, which I'm not sure I've done an episode about that, but I should, because it's outstanding. Now I owe you a show, I guess, if I don't see it in there, let me add it while I'm talking. So I stream, it allows you to play not just steam games, through the streaming steam app, but any app and any phone, any device, so it's cross-platform, it's ridiculous. I was on this super Elon Musk's internet star link in my dad's, and I was playing an action game, lightsabers, and everything, doing force powers, and it would glitch, you know, probably every two minutes or so, I would lose some frames, but it was not an only enough to where I could just sit there and play, and I thought it was crazy that I could, without my phone, I could even use a wireless Bluetooth controller, so you could have a controller in your hand, and whatever other device, I also have it set up to plug into my phone to plug into a TV, and then I plug the dongle into the, I plug a remote controller into the dongle, and then I also plug the HDMI into the dongle, and I also so plug in power to the dongle, and then I plug that whole thing into the phone, and then that feeds the signal to the TV, and I can basically play 720p anywhere, as long as there's high speed internet. It's actually pretty slick, so you can sit down on a friend's house or board, you can pull your phone out, and if you have a good speed connection, you can play remotely, and that's with the sunshine stuff, so that's what I have set up downstairs. Fortunately, it's kind of wonky with the controllers and the Bluetooth, and getting it all connected, so I have a script that I run that when you press a key on the keyboard, which I'll log in, and while we're doing that, while I'm explaining what I'm doing, I'll explain to you how it works. When you log in, when you press a key on the keyboard, when you press a key, that makes basically kills the sunshine client, and makes sure that the Plex app is running, the Plex, and XBMC, or whatever they're calling it now, HPC, Plex, or whatever, that runs that, and makes sure that's in focus. Now when you press W, there's some other things that happen, and I'll see if I can find that, there's a local bin folder, which I didn't start using until recently, I didn't know we had environment variables like that with Windows, or with Linux, so let's see, S, cat, S, cat, P, cat, P. Okay, so it looks like I have steam like this, an old script name, that is flat pack and stuff, that's not what we're looking for. Let's see if I put it somewhere else, I'll be Plex update all, I think it's going to be under Plex, I'm logged in as the wrong user, so first one is steam, which is basically now replaced with sunshine. It will start up the computer upstairs, so it sends either wake, so there's a magic packet that you can send to any desktop computer mostly, and it will turn it on, and it has to be usually enabled nowadays in the bios, off by default for security reasons, obviously, people got scared, so it sends that wake signal and says, hey, I'm waking up the computer, if it's not already on, you wait 10 seconds for something, and then it kills steam link, if that's running, which steam link's never going to be running again, because whatever, and then I kill moonlight, if that's running, if it's running in the background, sometimes the foreground and thing gets messed up, that's a media box, and who knows what's running in the background, and then I'll wait for 20 seconds, and then I'll run moonlight, and once I run moonlight in the background, I've already started restarting the Bluetooth service, so I know I have 20 seconds to reconnect the Bluetooth until moonlight starts, if you start moonlight, for me, my experience, if you start moonlight without having the controllers connected, it will be, it won't work great, I have it restart Bluetooth and basically wait 20 seconds before moonlight starts, so within that 20 seconds, what I can see is my Bluetooth dongle will blink, and I will have the remotes ready to connect within five seconds, I'll hold those down, and I'll get my blue link on both the Xbox wireless remotes, and then once moonlight starts, we're good to go. That's usually what I do, and then the other one is for, and that's for when I press W, when I press Q, that starts the, the Plex, which basically just starts HTPC Plex app, which is a snap package, and then of course it kills moonlight and all that good stuff, and it sets the gamma for the HDMI, which is kind of interesting, and then focuses the what window, if it's not there, maybe it got caught in the background, or something else happened, and moonlight's still running, who knows, and it brings that to the front of the screen. Now what I will say, the part that I didn't know about, is, X-Bine keys, and I still have problems with it, I really would like to have it set up to have like a function key or all key, and then I finally gave up and I used the number keys, because before it was Q, W, E, R, actually, and T. Now it's 1, 2, 3, 4, 5, which I find out is a lot easier to press numbers, assign numbers that it is to holding down keys on one of these silly robots. So how they work, I don't know, but I think when you send like a capital P, it's not actually sending the shift capital P, it's sending like the ASCII character code of capital P, and it's not actually in the caps lock state, or it's not being the control key or the shift key is not actually being held down. So if I hold down the alt key, that doesn't, I don't know if that actually gets sent to the server. I'm not having, there's ways to sniff the, the bind keys, X-Bine keys, you can sniff, but essentially it's fairly simple, you just have the key, the script, you want to want, it's called .X-Bine keys, SRC, no spaces, and that's in your root folder, and once you install it, it runs in the background, and the first command, the first in quotes, what I do is the command, and the second is the key you want to bind it to. So I have keys bound to 1, 2, 3, 4, 5. First key starts flex, so if something's going on, who cares, you press Q, and flex will be in the foreground, and it will be running. The second one again is 2, that's the steam, which we'll start up steam, we'll actually start up sunshine moonlight, and it will reset the bluetooth, so I can get the controllers synced up in time for the moonlight to run. And then 3, 4, and 5, 3, does brightness full to using KSA package, which talks to my weird, the only non-complicated internet facing IP or network-based dimmer, I could find that didn't have some crazy proprietary online only bit. So I don't remember what branded is, if I can look here, so now I can sit at the couch and turn the lights to 112, and then change the, I can turn the brights completely off by pressing 5, which I forgot about that one, actually. So see if I can look at my orders, search all orders, and we're going to say switch, or dimmer, dimmer, let's do dimmer. KSA smart 3-way dimmer, so the app is called KSA, and it's simple, it's KSA dash dash host, IP address, and the port is by default on a 9, and then type, you can say on or off, and I think dimmer is the type, so dash dash type, space dimmer, brightness, whatever, I'll put this in the show notes to cat x-bine keys. That's pretty much it, and it's pretty slick, I've pretty much got everything I set up, I would like the kitchen to automatically dim, kitchen lights to automatically dim, but in my wife said I'm not allowed to do that, so I would like if I press the play button on a movie that'll dim the lights in the kitchen, or something, I was told I'm not allowed to do that, but that's pretty much it for x-bine keys, I did have again have problems with trying to get it to do like alt Q, because if I'm trying to kite characters and I have keys bound to QWERT, if I'm trying to type like quick, or exit, I can't do that because whatever, and then I'm having to like hold down the shift key and like press the thing in opposite of the shift, so I finally realized oh I can just use the number keys, or the special character keys, and that will be 10 times easier to bind instead of having to figure out how alt works in the setup, because I couldn't get it to work, I think, because of the remote is kind of working, so anyways x-bine keys, easy way to run commands and Linux in the desktop port, at least xfce, I think is what I'm using, I'll take it easy, if you're hearing this might be in the reserve Q, probably not, I don't know, I don't think I'm going to put this in reserve Q. Unless otherwise status, today's show is released on their creative commons, an attribution 4.0 international license.