 Uh-oh, look at this unnerving blank gray screen. This is what you might see when you first log into a window manager you just installed. And I'm gonna talk about how to set wallpapers in a window manager in Linux. Actually, I should say it's not really Linux, it's really an Xorg specifically. I mean, people give arch users a hard time, but really it's Wayland users who won't shut up about the stupid software they use. They're not included in this video, sorry. We're talking about Xorg. So in any way, let's talk about, for all you normal people, let's talk about how to set wallpapers. Now, if you are using a window manager, if you just installed a window manager, you probably have no wallpaper by default. Some window managers have window manager specific ways of setting wallpaper. We don't need that, because we want something that can work on anything, okay? Additionally, if you're using a desktop environment, it probably has some extremely nasty way. I don't wanna use the word bloated, but that's basically what I'm saying. Some complicated way of setting wallpapers. But really the command you wanna look up is Xwallpaper. If you uninstall all that stuff, or if you're starting from the bare minimum, Xwallpaper is the command to get. It's actually not installed on a lot of distributions by default, but you can easily enough install it. And this just sets wallpapers. So let's talk about how it works, and I'm gonna talk about how I implement it, how I put it in my scripts and stuff like that. Okay, so let's just, so you know, you usually wanna have your given wallpaper that you want to be persistent after you reboot. You wanna keep it in a designated location. In my case, I keep it in config wall.png. Okay, that's just always where I put it. Now, what you can do if you wanna set that wallpaper is you just say Xwallpaper, and then you gotta give it an option, like how exactly you want it to be set. For example, you can center the file. You can maximize the file. You can tile it. You can stretch it. You can zoom it. Now in most, if you have a wallpaper that's exactly the size of your desktop, it's actually not gonna make a difference usually what you say. So let's say I set this wallpaper and I say zoom, okay? Now we're gonna have, let's look at our wallpaper, look at that. Oh, look at that. Oh, it's all nice. So what exactly are the other options? So just to be clear, let's actually look at the manual again. So let's say we have this. I'm gonna take that file. I'm gonna convert my wallpaper file. I'm gonna use an image magic command. I'm gonna resize it. I'm gonna resize it so it only has a dimension of 200 in width. And I'm gonna put it in small.png, okay? So now I have a very small file here, right here. And this is a image file that's much small. It's not big enough for our screen. Let's play around with how this actually works or looks when we run X wallpaper on it. So let's say we run X wallpaper center on this file. Well, that is gonna make it so, oh look, here it is. It's very small right here. You can barely see it, but it is there. And that is just basically going to set, you know, have it just in the middle. We can also have the tile option. So that is going to tile it all over the place. So now you see something like that. Or, you know, let's just have something more conventional like, well, center, we did that a second ago. Let's say maximize, okay? So all of these deal with files that are different sizes than what we actually want. Now, of course, we don't want any of this garbage. So let's actually get back to that full-size file so we can have a proper background. All right, so anyway, that is the command that actually sets the background. But the important thing is this command is not gonna be persistent if you reboot or restart your window manager. So usually what you wanna do is you wanna put this in your X-profile file or another one of the, or let's say if you have a window manager, if you have I3, you could put it in your I3 config. I think it's better to put it in your X-profile because that is gonna run no matter what desktop window manager you use or let's say switch to something else. So I'm gonna open up my X-profile and you'll see that this file basically runs every time you start the graphical environment. So it'd be nice to put in an X wallpaper command. You know, X wallpaper, zoom, and then the location that we want our wallpaper to stay in. So now, if you wanna change wallpapers, all you have to do is move that file to this location and run the X wallpaper command. Now, I have actually simplified that with a little script I actually uncommented for this video, that's why we started out without a background. But it's a little script called setBG. Let me show you what that looks like, setBG. So this basically is just a wrapper script. You'll see that it just runs this file. So whenever this script runs, or runs this file, it runs this command to set the wallpaper. But I actually have some other things, little perks installed as well, or perks to the script as well. For example, if I just run setBG, it will, you know, that's the command I run whenever I start up my X server. It will just show the wallpaper, okay? Simple enough, that's exactly what I just showed you. But here's some little scripting. If, for example, let's look at this line. So if we have an argument to the script, so let's say I run setBG on a particular file, what that does is it actually copies that file to the location where I keep my wallpapers. And additionally, it's gonna run a little command that says wallpaper changed, okay? So let's say I'm gonna go to my landscapes or something like that, and I'm gonna run setBG on one of my files here. It is gonna set the background to that, and it's gonna update. And you'll notice one thing about X wallpaper, every time I do it, my little face here will get desynced. That has to do with the X org server. I'm just gonna restart it or whatever. You may have noticed that I've been doing that, just turning it off and on. Cause I'm too lazy. You guys know I'm too lazy to edit it. You might as well do it real. So anyway, that's how you can reset. That's how I have one script that does two things, but it does them well. And that is starts, it changes wallpapers, and it also automatically loads your wallpapers. Now another little feature that I've added in is the ability to randomly select any wallpaper in a particular directory and run that. So as I said, you can feed it a particular file, and it will move that into the wallpaper location. It will also, let's look at what this is doing. If the argument you give it is a directory, it's going to move something, what's it gonna move? It's gonna look in that directory for all JPEGs and all PNGs, and then it is gonna shuffle them with number one, which means it's going to put them in a random order and pick the first one, or specifically just pick a random file. That's really what it's doing. And it's gonna move that random file to the wallpaper location, and it's gonna set that. So let's say, let's go out of our landscapes directory and actually run this script on landscapes. Let's see what happens. Well, it picks a random image. It sets that as our default. And so we can run that multiple times. And it's gonna randomly pick one. Great. Okay, so the last thing I have in my wallpaper script, and actually there's one, I'll talk about this in my wallpaper script, and then there's one other thing I think I gotta show. The other thing is I automatically have PyWall integrated. Now I don't have PyWall installed, but what PyWall is, let me install it, Python, PyWall I think is its name, the arch repositories. So what PyWall is, is you can give it a, well actually I'll just show you what it does just in case you don't know. Basically this just says if Wall is installed, automatically get a color scheme from it, okay? So I'm just gonna run set bg, and what that is going to do is it takes this background and it actually makes a color scheme based off of it. So you see our image is sort of reddish and orangeish, and it just makes this stuff right here. Great, so that is very nice. Additionally, now it works the same way, you can still give it, let's say we give it landscapes, again the same file we gave it a second ago, it's gonna auto generate a color scheme from that. So now it's sort of a blue, and I guess I don't know how you describe that, but now we have a color scheme that goes with that. So that is basically how it works. I have a couple things integrated into this, again the wall is just for auto generating a color scheme and most of my programs like DWMST will automatically load that color scheme. Now I do have some problems integrate, so you'll notice the terminals that existed beforehand, they don't fully get the color scheme, there are some issues with that, but it'll be updated for all terminals you open afterwards. So the last thing I wanna show you is just a little script, so I know a lot of people like having the ability to just manually select a list of wallpapers or something like that to choose from. Well I actually have another little script here, it's called, actually I guess I can just run it, well it's just called LWP. Now what WP does is actually I'll show you what it does, actually here's its default mode, but what WP does is it just finds all the files in my wallpapers directory, it shuffles them, it pipes them to shuff which just puts them in a random order and displays them in SXIV. Now SXIV you should definitely check out if you don't know what it is, it is a image viewer, I've done a video on it, it is fantastic because it has this gallery mode that's built into it, so you can automatically do this, but you also have the ability to run scripts on the files you're dealing with. And the nice thing that I have is I actually have the ability to select one of these and I'll say XW for wallpaper and it will automatically change that wallpaper by running set BG, okay, so there, get my face out of the way so you can actually see it. Or let's change it to another one, let's say this one, set that wallpaper and now that will be our wallpaper, it's taking a second just because I guess it's running pie wall in the background as well. So anyway, that is a nice little way that replicates what a lot of very complicated, I guess wallpaper setters do, except for I don't have any complicated programs, I just have SXIV, oh you should definitely check this out, if you haven't checked SXIV out, just search for it, I've done a video on it, other people have done videos on it, it's fantastic, but I use my default image viewer in place of any kind of fancy wallpaper selector and the nice thing about this is because I'm shuffling them, if I pull this thing up again, if I run WP again, it is gonna give me an entirely different set of wallpapers because it's just taking all the wallpapers I have and just randomly sorting them. So, one thing that always annoys me about either picking wallpapers or let's say even if you're picking a song to listen to, it's annoying seeing the same things at the top all the time, so all you have to do on the command line, you just pipe them through shuff and that's it. All right, so that's how I set my backgrounds, that's how, I mean, this may seem like a complicated video to do something as simple as setting your backgrounds, but the takeaway is X wallpaper sets your backgrounds and you can change that, you can extend that in any way you want, I have this nice little interface for choosing wallpapers, or you can manually go in and choose one, in fact now since I have this script set BG, I can actually have this script run all the time, like I can have it set to keys in LF or Ranger or something like that and it's very nice. All right, so that's about it, I'll see you guys next time.