 In the last couple of days, I've spent a few hours working on my X-Monad config, really just kind of playing around, having fun. I've been experimenting with some different X-Monad libraries, some that I've used before in the past, and some that are brand new to me that I wanted to check out. And one of those that I wanted to check out that I'd never used before was the Named Actions module that's available for you in X-Monad and Named Actions. It's what you do is you add a Named Action to a Keybinding. Essentially, a Named Action is a description. So now, instead of having your Keybindings as two values, the Keybinding and then the Action, it performs. You have three values. You have the Keybinding, then the Named Action or the Description, and then the Command that it actually runs. And then X-Monad takes all of your Named Actions, all of your Descriptions, essentially, and you're able to pipe that into another program for displaying those Keybinding Descriptions, those Named Actions. So the way I had been doing this before, I was actually just using a little Bash script to get all of my X-Monad Keybindings. So if I go down to my Keybinding section, this is my old config before I started working on it this past week. Let me zoom in here a little bit so you guys can see this. I had this Keybinding here, mod shift slash, which is really just mod question mark because shift slash is, of course, what you do to get a question mark. So mod question mark, it's kind of like a help command, right? And I have it pointing to this command here, which is just a shell script that I wrote called X-Monad underscore keys dot sh. Now let me actually open that file. So let me go into my X-Monad directory here and find that little shell script. It's basically a said command, a said statement. Well, that's actually said and gripped, a lot of said and gripped. And what it does is it goes and finds this comment here. This is just an arbitrary comment I added to my X-Monad config. Start keys, said goes and finds that start keys also at the very end of my Keybindings have a end keys tag. So it finds start keys and end keys. And then it takes that entire block and then it grips and said some stuff out to where now when I do my question mark or mod shift slash, I get the output from that little shell script inside a YED dialog box or actually this is a text info box. So very simple little script. This was not complicated to do at all. But I wondered if there was a more Haskell kind of way to do this, a more X-Monad kind of way to do this without having to involve some third-party shell script. And yes, there actually is. There is this library called Xmonad.util.namedactions. So this is rather easy to get up and working. Let me zoom in a little bit here in the browser. All you need to do is in your config, of course, you need to import Xmonad.util.namedactions, this library. You also need to be importing Xmonad.util.easyconfig. You need to be using the easy config key bindings, which are the simplified way to write the key bindings, which I think most Xmonad users probably use anyway. And then in your main block, you have main equals Xmonad. And then, you know, all of the rest of the stuff behind that, you know, your settings for your mod key and maybe maybe stuff about Xmobar, yada, yada, yada. Somewhere in there, you need to add this section here, which is add described keys and then a key binding and then my keys, which my keys should, of course, equal your key binding block somewhere in your config. And you see, you have to give it a key binding. In this case, it looks like they're going to set it to mod for mask and then the F1 key. So that's alt F1 should bring up our list of key bindings displayed and whatever GUI program we want to display it in. And you see, for the key binding, for the add described keys, it's not using the easy config key bindings. It's actually using the long form. So that's very important to know when you go to add this to your config. And then in your key bindings for every key binding that you want to have displayed as part of the named actions, you need to go in and insert add name and then your message and then dollar sign and then the command or the key binding. So typically, you wouldn't have this middle section here as part of your key binding. So you need to start adding add name, whatever message, dollar sign, and then the name of the command. So let me show you this in my new config here. So let me show you the state of my current config and let me zoom in. I'm going to go down here to my key bindings section and you will see now this actually took me a couple of hours because I have so many key bindings. I had to add this add name portion to the key bindings. I also tried to space it so it's easier to read. So I did the add name and then the description and then I spaced over an equal amount of spacing for the dollar sign and then the commands that they actually run just so it visually it stands out, you know, this is the key binding and the description and these are the commands that they will run. I also had to change this block here, which before was my keys without any kind of argument. It didn't have this C argument. You have to have this C argument now and you're going to need to give it some kind of subtitle name. I called it custom keys and I got all of this from the documentation, by the way. You will see there is exactly what I have in my config on this line here. I went ahead and gave it a type. You don't have to. The Haskell compiler knows exactly what type it's looking at here, but I went ahead and just specified it just for my own sake so I knew what I was working with here. So once I had all of these add name descriptions for all of my key bindings and I've got a lot of key bindings, then I need to go down into the main block because remember we have to add behind xmonad here dollar sign and then add describe keys yada yada yada and give it a key binding. I just stuck with the default which was a mod4mask f1 which mod4mask, mod4mask is the super key, mod1mask I believe is the alt key, isn't it? Let's try it out. So what I'm going to do, I'm going to go ahead and write our new file and recompile xmonad and now let me restart xmonad and now if I do super f1, yeah. So this is the named actions, right? And you can see it is a little bit nicer formatting than my shell script. It does have some issues though. I'll talk about that in just a second. By the way this program that it opened in this was again yad yet another dialogue and you can actually change what program the named actions get piped into and displayed. Let me go back above my key bindings. I actually have this function here show key bindings x equals add name show key bindings io and then do this is a do block and essentially what are we doing with the piping named actions get piped into some program. I'm piping it into yad with a text info style box and then I specify font foreground color background color it's centered in the screen. I want a geometry of 1200 by 800 and I titled the window xmonad key binding. So once again if I do super f1 and xmon bar while it's highlighted you'll see xmonad key bindings as the window title. Now of course the foreground colors the background colors yada yada yada so that is the settings for yad but I could change that I could have used the old zenity program there's probably other things I could have piped this into but yad seems to be the standard so that's what I'm going with here. I mentioned there are some limitations to named actions at least so far I haven't worked out a way to actually break up these key bindings in a conventional sort of way because these first groups of key bindings these are not actually my key bindings these are the default xmonad key bindings it goes ahead and displays those and then at the end of the default xmonad key bindings you will see I have this new subtitle custom keys remember I gave this subtitle custom keys to my keys that block there so custom keys are all of the key bindings that I defined with their descriptions it's just this one gigantic block of custom keys I would like to be able to split that up into different groups because I don't want you know all 100 and 200 whatever key bindings I have to be all in just one block under custom keys I would like to split them up hey these are key bindings for switching workspaces these are key bindings for window actions these are all of my emacs key bindings yada yada yada you know I would like to be able to split that up but I haven't worked out a way out for that and I also do not want the default key bindings displayed because these are not key bindings that I set and in many cases I've actually overwritten some of these key bindings for example the default key binding to open a terminal in xmonad is mod shift return but in of course mic and fig mod shift return launch this D menu right mod shift return so uh so it actually is listing some key bindings that don't actually work and I don't know how to correct that but I'm going to keep playing with named actions I think it is a better way to go than the old shell script that I was using because I do want to eventually do as much using the traditional Haskell libraries rather than relying on third party shell scripts for this so eventually I want to clean this up to where this is a lot nicer and hopefully where it displays actually correct information where now you know the standard key bindings and the ones that I've overwritten myself both are displayed so it will actually I mentioned mod shift return launches a terminal according to the default key bindings but in the custom keys block somewhere in here I will have mod shift return right here and you can see for me that is our run prompt our D menu prompt so I may need some of you Haskell pros to look through the source code for the for the named actions here because yeah I'm not I'm not able to to figure this one out let me kill that cocky again the other Haskell library that I've been playing with or xmonad library that I've been playing with is grid select now grid select is one I have played with a little bit in the past I've actually made some videos about grid select of three or four years ago and I was revisiting it because I remember liking grid select a lot so let me go to the top of my config because of course I have a table of contents here in my org document and I now have this section grid select I've always had a grid select section to my xmonad config but I've really started doing some more stuff with it because I think it's a fascinating way to navigate your system what is grid select well it's where you specify some programs that you can launch you know with this grid like menu and this is really cool you can navigate it using hjkl the traditional vim keys or the arrow keys you can also do a search for example if I start searching for I don't know emacs I can just do slash the traditional way to search in vim or evil mode in emacs slash and then emacs right I can just start typing or if I decided I type something wrong I can backspace and I can eventually back out of it all the way or I can just hit escape and now I'm no longer searching I can just navigate again with hjkl and till I reach something I hit enter and it launches the program and looking at the source code for the grid select libraries I noticed all kinds of stuff I never actually noticed before there's a lot of settings particularly you have these navigation settings which I never played with because the default navigation settings just using the vim key bindings hjkl just work and so do the arrow keys I never needed anything else but there's other things that you could set well actually there's other things that are already set many people don't know because it's not obvious that they would be set for example I really didn't know you could search in the grid select until I noticed that they had actually had a default key binding for the slash key and it runs this command substring search my navigation so that is actually the function when I hit slash and now I can start typing you know pc man fm for example and if I hit enter it selects it if I hit enter again it actually opens it that's one annoying thing is you have to hit enter twice after doing the search where to me that doesn't really make any sense because doing the first enter really doesn't do anything because you can't back out of it you know if I do slash pc man fm and hit enter to select it well I really can't unselect it because escape does nothing right it just cancels out the whole thing so really that first enter is useless it really just needs to be one enter and it launches the program I don't know if there's a way I can actually make that happen one of the really cool things you can do with the grid select is you can actually change the way you navigate around with the motion keys for example now I'm just using the standard hjkl and then of course up down left and right so you see that when you hit the left key it goes minus one and then zero those are x y coordinates so it moves left right and then h also does the exact same thing minus one zero so that's the standard vim motion key for left and then you have right and l at one zero and then down and j at zero one and then up and k at zero minus one that kind of makes sense but I notice there's these other motion keys that we could use too if I go back to the web page for the grid select libraries they had this block of code here as an example I notice they also had other than the standard motion keys they had y i n m and space as examples and they're moving two directions they're moving for example y moves left and down at the same time i moves right and down at the same time yada yada yada so I added some of these to my config now these aren't quite working right the only one that really works is in and I'll explain why that is in just a second but you'll see n moves minus one and plus one and this achieves a really neat effect so instead of moving hjkl like I'm doing j for down k for up watch what happens when I do in it moves down right and then in again moves in a diagonal direction right it moves over one up one and then you know see if you can figure out what it's doing it's circling the center right it's going in an ever expanding diamond pattern and that is just a really neat way to navigate a menu I would have never thought of that myself I'm actually going to use that now they also have a yi and m which are other variations on what n is doing but those are not working for me at the moment or at the very least it is not working in this version of grid select this is a spawn selected command so there's various commands you can use to run a grid select kind of menu I'm using spawn select to generate this menu and spawn select does not at least I haven't figured out a way to where it allows me to pick my own custom colors my own custom key bindings for example I've set these custom colors and these custom key bindings but these don't work with that spawn selected kind of grid menu they work with like your window menus where I can have a grid select of all the windows open so for example if I run this key binding here these are open windows that I have on my screen right now and you say these are different colors these are actually custom colors that I set here and of course that is also accessing I think these custom key bindings here where none of this customization that I have here actually works using spawn selected which generates the main programs menu so that is kind of unfortunate I haven't figured that out again you high school pros out there I may need your help to figure that went out and then kind of like I spent a couple of hours playing around with the named actions and adding descriptions to all of my key bindings I spent a couple of hours creating grid select menus because I didn't want just one gigantic grid select I wanted multiple grid select menus based on categories so I actually created a GS categories and then I created this list of tuples here for names and commands so I have this key binded to super alt C for category and you see those are the categories and what are the categories well the categories are these other tuples so GS accessories you can see I actually don't have an accessories category so that is a block I'm not even using I probably should just get rid of that I don't know why I added that so let me write and then restart make sure everything works yeah that was just an extra block I have because I have games and education I have games and education here they are out of order actually let me put that in the correct order there but you see the very first grid select menu is a list of categories and all it does is it runs xdo tool key and it does a key binding because I have the individual categories also on key binding super alt and then one through eight so if I do super alt one that's the games category right just a list of my games I do super alt two that is the education category super alt three this is the internet category yada yada yada and if I just do super alt C that just gives me a list of the categories and now if I hit enter on internet it still runs that command because it essentially presses the key binding with xdo tool to generate the gs internet array I hope that makes sense and of course how do I get the big group of key bindings that I have set to super alt enter well I have a key binding specifically to concatenate all of these individual lists but you say I have you know gs office gs settings gs system gs utilities if I go back down here to my key bindings you will see the very first key binding super alt enter or you know mod mod one return now it's written in easy config it has the add name description and then it runs the command spawn selected and then you have to feed spawn selected a list well I feed it a bunch of lists so I do dollar sign and then I concatenate all of those category lists so that it creates one big list but again I can split it up if I only want the games or if I only want whatever this is probably system tools or if I want to just choose the categories myself if I forget the key bindings for the individual categories super alt c and then I could just navigate you know to the office category or whatever it is I am after so that's a little bit with what I've done with grid select and with named actions and I'm I spent a few hours on it and again I'm not happy with either one as they currently stand I've pushed this to my personal dot files config this is not going to be part of DTOS until I can figure out some of the bugs because right now grid select I need to be able to customize the colors and I need to be able to customize the key bindings for the spawn select command and I haven't figured that out and for the named actions I really need somebody to tell me how to create subgroups within those custom key bindings because right now it's all just one group and under one heading and I need to figure out a way to remove the default key bindings from the output produced by named actions so you guys got any ideas let me know you can let me know in the comments below but a better idea would be to open an issue on my get lab and let me know the solutions and 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, Michael Mitchell, Paul West, why you balled on me Alan, Armored Dragon, Chuck, Commander Angry, Diokai, Dylan, Maristrom, Erion, Alexander, Peace, Archimoudour, Polytech, Riala Teeth, for the Lesser Red Prophet, Steven Tools, Devler, and Willie. These guys, they're my highest-eared patrons over on Patreon without these guys. This quick look at grid select and named actions in Xmonad would not have been possible. 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, these are all my supporters over on Patreon because I don't have any corporate sponsors. I'm sponsored by you guys, the community. Would you like my work and want to see more videos about Xmonad? Free and open source software. Subscribe to DistroTube over on Patreon. Peace. This video is just me asking you guys to do my homework for me.