 When you use a tiling window manager one of the things that you probably install is some kind of bar now That's not obviously not true if your window manager comes with a bar But for those of you who using a window manager that doesn't come with one You're probably going to look for some type of bar to install whether that's poly bar whether it's tint to whether it's xmo Bar whatever it is Tenses are you're looking for some kind of bar now poly bar is my favorite bar out there out of all of them And there's a good reason for that is because it actually has this a ton of stuff that you can do with it Right out of the box, and there's hardly any configuration that actually needs to be done And even when you're in some kind of advanced situation where maybe poly bar is not officially supported by your window manager For example xmo nad it's easy to get around the problems that xmo nad happens to Cause poly bar you have to use a certain module in order to get workspaces to work for example And even then they're not perfect But at least there's some kind of solution there one of the things that I like most about poly bar is that there's just a ton of stuff that you can do with every single module that's there and Most of that stuff is officially supported and there's Established syntax for you to accomplish those actions without having to delve deep into like source code or something like that So what I thought I would do today is take you through a process of how to enable click actions for your poly bar modules this is actually fairly easy and That's another thing that I really like about poly bar is that it's really really easy to set up So let's go ahead and jump in so the first thing you'll need to do is go into your poly bar configuration file for most people this is going to be in Dot config slash poly bar for me it's in my BSPWM folder slash poly bar and Mine looks different than most people's because what I've done is if I them into my config file You'll see here at the top that I've included several files into this Configuration file and all those things are separate. So none of my modules are actually here the only thing that's in my configuration file which is about a 140 lines long is Just the bar definitions themselves. That's all that's here all of my modules are actually in their own little file So if I go to this file here This is what just all my modules and you can see that there's just a ton of stuff here There's only almost 1100 lines in this one. That's just not normal for everybody I it's just something that I do because I prefer my config file to be a little bit cleaner But it doesn't matter no matter how you've set up your poly bar whether it's this way or just the traditional way This works the same So the first thing you need to do is choose a module that you want to Upsign a click action now. I suppose I should explain what a click action is It's really simple and very obvious all you have all it means is that when you click on something So let's just say I click on this one here, which is an MPD module It's not the official MPD module that has click actions built in This is just a script that I created and then is displayed on poly bar if I were to right click on that right now Nothing happens, but what I want to do is set it up So something happens when I right click on it Maybe something happens when I left click on it and so on so a good example of this that is set up by default Is the clock now my clock doesn't work the way the default clock would work Normally what it would do is switch to an alternative display of the time and date for me when I click on it It shows me the day of the week I click on it again, and it shows the time so click click click click simple, right? That's what a click action is so let's actually go to my music one here and Set up a click action. So let what do I want it to do on a right click? So in this case, I would love it to bring up NCM PC pp I think that's how that's the number of pps in it. That's it's a stupid name, but I always get it wrong But it doesn't matter. So we're here at the module. So you go to your the module you want to change and Then you want to put the action that you're going to do so in this case. I want to do click dash left Equals and then you want to tell poly bar what to execute when that action occurs So this can be any number of things. So let's just say you want to open up a terminal with a music player That's what I'm going to do here. So I'm going to do quotation marks alacrity Dash e and then NCM PC pp Yeah, I think that's the right name for it. Anyways, if I save this now and Reload poly bar What I should be able to do is Click on this with the left mouse click and have the music player come up and we see that does now for me I don't want my music player to be brought into the tiling stack I really don't so I have a class set up in a rule set up in BSPWM for a class called Music or I think it's called muse. So with alacrity what I can do here is go back here is do dash dash class and then If I can type and you s slash and you s or not slash comma and us and then save this again We start poly bar and now if I click on this with the left mouse button It's floating and that's exactly the way I want it to work All right, so now that we've set the music player up to come up when there is a click action on the MPD module What happens when we want to say do something based on a script instead of something that comes up in the terminal? That's actually fairly easy. So let's go down here to the the updates module And I'm actually going to show you this because this module isn't actually in my poly bar right now But let's just say that I wanted to every time I click on this run a script that would update my computer I mean why not and I had a let's say I've written a script that will do just that be a really simple script and But let's just say I wanted to do that. So let's do click dash left Equals and then the path to the script. Let's literally all you have to do now still the slash Let's just say user local. I actually have a script like this local if you can type bin update s H and You can do it that way or you can go through and do I believe EXE EC I don't think you actually have to do that if for some reason just the path to the script won't work put EXE In there or alternatively alternatively if it's a bash script, you could do bash and then it will know that you execute bash If it's a Python script, you could do Python Again, if you can you know type which I can't but anyways you get the idea Okay, so you can run scripts that way you can run things that are going the terminal if we wanted to go through and Just just say open up a Actual actual application. Let's just say for whatever reason here in the weather every time we want to click on it We want to open up bit warden. So we just type in bit warden And we'll save this restart poly bar Click on the weather and we get bit warden Cool, huh? And that's you know, you can literally open up anything and you can use other things other than the The left mouse button. So if we wanted to change that to right We just do click dash right if we wanted to do the middle click we do click dash middle That's how you use click actions. It's very simple and as far as I know That can be used with any single module that poly bar has even the custom one so like the MPD one that I showed you to begin with that's a custom module that I created and The click dash right and click dash left and click dash middle work just fine even on the customs modules So That allows you to add a lot of functionality to your bar that wouldn't necessarily be there Otherwise so now for me, I don't know how useful this is going to be I'm going through and setting them up anyways because I actually want them to be there But I try not to use my mouse on the bar I tend to do that sometimes anyways, which is why I'm setting it up but for the most part I'm trying, you know, I always try to Interact with my window manager through the keyboard, but it doesn't matter it The fact that these actions are not there Make my bar even more useful So that is it for this video if you have questions you can leave those in the comment section below You can follow me on Twitter at the Linux cache You can support me on patreon at patreon.com slash Linux cast before I go I would like to take a moment to thank my current patrons Sid a Davon Chris East Coast web gen 2 is fun to Patrick O primus Marcus Megalyn Jackson I'm Phil Steve a cyber guy Linux Mitchell archsner Amityus carbon dated Merrick camp drash really J dogs the beasties rock Peter a and crucible Thanks everybody for watching. I'll see you next time