 Out of all the bars out there, Polybar is my favorite one, and it's not even really a close competition. Polybar is the bar that I use with basically any window manager that I use. Even the window managers that don't really support Polybar, I try to use Polybar there because it's just really good. Now, I know that other people will argue that other bars are better, but I don't really care about that. Polybar is the one that I like the most, and it's the one that I've spent the most time learning how to customize. So what I thought I would do today is talk about five hacks that I've learned over the last few years that allow me to take my Polybar usage to the next level. So let's go ahead and just jump right on in because these are kind of cool. The first one on the list is the include file option that the config file gives you inside Polybar. And what this basically allows you to do is link to other files outside of your configuration file. And why this is good is it means that you can create files that contain parts of your config, but that aren't actually included inside of the config. So for example, I have a theme file that I link to through the include file options. So if I go to that, that has all of my color variables. I leave them all there, and that allows me to easily change what theme I'm using by just changing that particular file instead of having to change the entire configuration file, which is kind of cool. I also have a file where all of my modules are stored so I can go to that file. And this is just all of my modules. The other good thing about this is that it allows you to kind of be a little bit more organized in your configuration file. You can have just your bars in one place, your theme in another place, your modules in another place. And it kind of makes it so that your configuration file isn't so damn long, because some configuration files can be very long, especially if you're using a lot of modules. I've seen configuration files run up to 2,000, almost 3,000 lines, and while that doesn't necessarily mean that your poly bar is going to run slower or anything, it just makes it kind of hard to scroll through when you're trying to find stuff. So by separating things out using include-file, you can have your configuration file be a little bit cleaner. Okay, so the next one is color variables. Now basically what this is good for is it allows you to have variables set in one place and then you can just call those variables wherever you want to use them. So here's how you set variables. You can do this inside your configuration file really easy, just like this underneath a colors banner. And you just name the variable, hit equals, and then the hashtag or the hex of the color that you want to call or assign to that variable. And then when you want to call that variable, no matter where that's at, whether it's for a background or a foreground or for a text color, whatever it happens to be, you call it just like this. You do dollar sign, squiggle bracket, colors, dot, and then the name of the variable. So in this case, sign, and then you close the squiggle bracket. That's how you call the color. And this means that you don't have to always have to know what that particular hex value is. You just have to know what it's called. So if you know that you want to use the sign color, you just use colors that sign instead of knowing that it's pound, whatever it is, you know what I mean? You don't have to type those every single time. You just type in colors dot sign or colors dot green colors dot whatever, you know, whatever you've named that particular variable, you can then call that variable here without having to use the hex code over and over and over again. So that will save you a lot of time. Okay. The third one on the list is per module fonts. Now in your configuration file, somewhere you will have a few lines that look like this here right here. These lines here. And if you've ever wondered why you have multiple lines like this, you might not know that you can actually use these in spots wherever you want. So you have font zero, font one, font two, font three, and then you've assigned fonts to them. If you have a situation where you want to use one of these specific fonts, you can do so by just calling content dash font equals four. Now this may be a little bit different depending on where you are in terms of the configuration file. So in this case, it's content dash font equals four. So this is the fourth font. If you were going to do this in a situation where the object that you're trying to modify is called format, you do format dash font equals four. So in this situation here where the output of the module is format, you do something like this. You do format dash font equals four or whatever the number is. Now remember, you started at zero, that font dash zero is actually font number one. So this is calling the fourth font, not font dash three. Okay, just keep that in mind. And if you're in a situation where your font's not actually getting picked up, make sure you're calling it the right thing. So like I said, it could be either content dash font equals whatever or format dash font equals whatever. It really depends on what this here is. So sometimes they use format, sometimes they use content. Just know that that could be different depending on which module you're using. That tip is really good for if you want to use specific icons in your bar from different fonts. You want to use some from nerd fonts, you want to use some from font awesome. You could do both. You just have to specify that within the module. Okay, so the next one on the list is kind of nerdy. So one of the things that you might struggle with as you're doing your rice, if you are trying to get the spacing between your modules correct. Now there are several ways you can actually do this. The first way is format dash padding. So this one like the one we just talked about where you do per module fonts. It can be either content dash padding or format dash padding or a couple of other things. It really depends on what module you're in, but you can assign specific padding just for that particular module in almost every module that is included with Polybar. So you can change that to whatever integer you want. So it can be one, two, three, four, whatever. That will create actual padding around both sides of the module. So just keep that in mind. Now if that doesn't work, you can also do just for the prefix. So if you want to create space just around the icon. So that's what this look line looks like format dash prefix dash padding equals one that creates padding just around the icon. Now if neither of those work and you want to get a little bit more nerdy about it wherever the module actually tells what to output. So in this case, a lot of times you'll see this type of thing here percent time percent, whatever percent output percent, whatever it happens to be. If you want to create space between or around the actual output of the module, you can do something like this. So you do percent squiggly bracket capital T three and then squiggly bracket. And then you have to end that and surround the output with percent squiggly bracket T minus squiggly bracket. So why that works, I have no clue. It has something to do with the way Polybar reads the output. I'm sure there's some technological stuff that surrounds that. Absolutely that somebody else could explain to you. But this is the way you can put some space around that output. And you can control how much space by changing this number here. So you can use whatever integer you want there and the higher you go, the more space you'll have around the output itself. Now remember that this is just the output. It doesn't have anything to do with the icon. It will leave the icon in the same place. There's actually a fourth way that you can put some space in between the icon and whatever comes next. And that's simply by wherever the prefix is. So in this case, the icon is almost always called the prefix. If you put a space just inside of the parentheses, wherever you've put the icon, that will actually give you a space afterwards. Or you can put space before it by doing the same thing. That is not the best way of doing it. But if all else fails, putting some space inside of those quotation marks will give you some space before and after before or after the icon itself. Okay, so the last hack on the list is adding transparency to Polybar. Now there's a couple of ways you can do this. You can mess around with your compositor. If you use something like PyCom, you can use that to add transparency to Polybar. It doesn't always work. So it's kind of finicky. And I've had it break Polybar many times. So it's not the best way of doing it. Polybar does actually support transparency by itself though. But there's not an actual opacity variable that you can set somewhere in the configuration file. Instead, you just have to use the Pacific hex code for the transparency that you want to use. So in this case, what I want to do here is show you by adding transparency to the bar that I'm using right now. And you do that by adding two letters to the front of your hex code. So in this case, for the background, I want to make the background transparent. So I'm going to use AA. And then I'm going to write this. Now, if I reload my one dark rice here and do this, you'll be able to see now that my Polybar is actually transparent. So if I change to a different workspace, you can see that it has some transparency. Now, it's not completely transparent. So how would you get it to be completely transparent? The answer to that question is that you increase the value of that initial two letters. So BB is more transparent than AA. CC is more transparent than BB. Same, you know, just keeps going on and on. Now, the thing is, is that by the time you get to ZZ, you're still not fully transparent. Instead, what you actually want to get fully transparent is 00. And you save that. And then if I reload my one dark configuration file now again, you'll see now that this is fully transparent. Now, it's not the best thing in this current situation because it doesn't really allow the text to show up. But if you want your Polybar to have transparency and you want different levels of transparency, that's how you do it. You use AA, BB and so on and so forth to get to varying levels of transparency. And 00 is complete transparency. There's no background there whatsoever. So that is transparency. So those are the five little tweaks to Polybar that I find very useful. Honestly, the one that I like out of all those is the include file because I have somewhat of an obsession with keeping my configuration file as clean as possible. I like to have them organized in such a way where I can kind of know where everything's at and I don't have to scroll for 10,000 lines. That's my favorite one out of all of them. I hardly ever use transparency on my bar for whatever reason. I just kind of can't stand it. But I know a lot of people like that transparent bar looks. So if that's something that you like, maybe that can help you. So I hope one of these at least was something that you didn't know. If you have other tweaks to Polybar that you're interested in learning, let me know in the comment section below. Maybe I'll make a video about it someday. You can follow me on Twitter at Linuxcast. You can follow me on Macedon or Odyssey. Those links will be in the video description. You can support me on Patreon at patreon.com slash the Linuxcast. I don't know why that went really fast here or why everything's all kind of like stretched out there. I changed the graphic earlier today and things are just kind of all over the place. So I apologize for that. Anyways, thanks to everybody who supports me on Patreon YouTube. I really truly do appreciate it. I will fix this graphic so it doesn't look like it was stretched a lot. I don't know why that's so... Look at the logo there. Ooh, that's really stretched. Anyways, thanks for watching. I'll see you next time.