 Today, I want to share with you a command line utility that, especially those of you that use standalone window managers, I think will find very useful. This command line utility is called xdo tool. What can you do with xdo tool? Well, most people are going to use it to simulate key presses or mouse clicks. Let me switch over to my desktop and let me open a terminal here and if I do a man on xdo tool, let me zoom in a little bit. If we read the description, you can see xdo tool is a command line x11 automation tool. It actually has a lot of functionality built into it, but again, most people, I would say 99 times out of 100 if you're using xdo tool, you're probably using it again to simulate a key press of the keyboard or a click of the mouse. So let me show you an example of xdo tool in action. So let me quit out of the man page. If I do xdo tool and then space, key space and then some key binding, for example, super plus B, I have that binded to launch my cube browser. And if I hit enter, basically what that did is that is the same as me actually hitting super B on the keyboard. That is just a command line way of simulating that key binding. And you can see it launched the cube browser by up arrow. And I do xdo tool, space key, and then a key binding. How about I'm on workspace one right now, but maybe I want to go to workspace three. So if I do super plus three, I just went to the third workspace, right? Let me do super one on the keyboard to actually get back to the first workspace. And let me do a TLDR on xdo tool because I have the TLDR program installed. What this is, is a little cheat sheet for the most common commands with xdo tool. For the most common command is the one I just showed you, the key binding. And the other one that you will often use is xdo tool click and then whichever button on the mouse. So you can see xdo tool click three is simulating right clicking the mouse. And I've actually used this one in the past too, because this is very useful. For example, many standalone floating window managers especially have right click menus where you right click on the desktop with a mouse and you get your menu system to come up. But what happens if you can't right click on the desktop? For example, if you have a bunch of windows open or one window full screen, then there's no desktop for you to actually click on, right? But if you have a panel, what you can do is you can have an icon on a panel. And I've actually done this with open box in the past. I just have an icon on my tint two panel and open box. And I have that icon set to when I click it. It actually does xdo tool click three. The same as actually right clicking the mouse. And then my open box menu would come up very cool trick. And I often use the xdo tool key command with my tiling window managers. For example, let me get back into the desktop here. This is my xmonad config. If I do a search for xdo tool here in my config, I have several instances of xdo tool here. It looks like I'm using xdo tool here for the grid select. So in my xmonad config, if I do super plus alt plus return, it brings up this grid select menu. And of course, I can navigate with the hjkl keys and just pick an application to open. But I also have some other grid select menus that just bring up categories of applications rather than just having that one big menu with all the applications in it. So if I do super alt C, I can actually bring up this grid select menu where instead of applications, it has the categories here. You can see I've got games, education, internet, multimedia, office, setting, system, and utilities. And if I click on one of these, then I get a new grid select with the applications that fit within that category. Now, I had to come up with a hacky way for this to work. Because by default, the grid select expects you to give it some kind of shell command. But I don't want a shell command, right? I really wanted to be able to pick, for example, games here in the menu. And then it would automatically spawn a new grid select menu with games in it, right? And the only way for me to accomplish this, because there's no command, there's no shell command for me to enter at the command prompt and do a grid select in Xmonad. Because the Xmonad commands are specific within Xmonad. They're not really shell commands. But what I could do is I could simulate some of this by using Xdo tool by setting these key bindings. And that is kind of how I accomplish that in that really hacky way. If I actually do a search again for Xdo tool, I scroll down here. Further in my config, you can see my workspaces that I have set. Let me zoom back out. You can see I have my workspaces. This is a list of workspace names, right? And I have nine workspaces. And the nine workspaces you can see up here in the Xmobar. I wanted these workspaces to be clickable. And there are some hacky ways you can make Xmobar accept mouse events, clickable events. And one of the ways I accomplished this was actually by using Xdo tool. Because Xmobar allows you to set actions, shell commands by clicking on certain things in the bar. And what I wanted to do is I wanted to set these workspace names. Well, by default I can do something like, you know, super three to go to workspace three, super four to go to workspace four, super one to go to workspace one, super two to go to workspace two. So all I did is I made sure that the workspace names up here, they actually run the command, the shell command, Xdo tool, key, and then super plus. And then I give it an integer i where i is one through nine depending on the number of the workspace in this list. And now you can see I could actually click with the mouse and change the workspaces here in Xmobar, now I never do that because it's all keyboard driven. But if I wanted to, it's there, it's available. So that's just a little bit of what you can do with Xdo tool. It's a very straightforward command. There's not a lot to it. And again, 99 times out of 100 which you're gonna use Xdo tool for is simulating key bindings or mouse clicks. And again, it's really important especially when you become a standalone window manager user because you're gonna find a lot of standalone floating window managers and telling window managers that you're trying to do things in and sometimes you can't actually give it a legit shell command, but you can actually feed it one of these key press events and that will accomplish what you wanna do. Now before I go, I need to thank a few special people. I need to thank the producers of this episode, Dustin Gabe James, Matt Maxim, Emmett Michael Mitchell, Paul West. Why you bought homey? Allen, Armored Dragon, Chuck Commander, Rengre, Diokai, Dylan Gregg, Morris Drum, Erion, Alexander, Paul, Peace, Arch, and Vitor, Polytech, Realiteats for Los Red Profits, EvenTools, Devler, and Willie. These guys, they're my highest tiered patrons over on Patreon. They are the producers of this episode. The show is also brought to you by each and every one of these fine ladies and gentlemen, all these names you're seeing on the screen right now. These are all my supporters over on Patreon because I don't have any corporate sponsors. I'm sponsored by you guys, the community. If you like my work and wanna see more videos about Linux and free and open source software, subscribe to DistroTube over on Patreon. Peace guys. X-Dew Tool is like duct tape. It's a hacky way to fix any problem.