 Hey, what's up everyone? So another brief video on i3 hacking or configuration, whatever you want to call it. Just some basic stuff, but for those of you who are still sort of getting familiar with how to manipulate Windows and stuff, this is a really helpful thing even if you don't use a webcam. So I do use a webcam. As you see, I have one down here. I always have it in the bottom right. If I pull up multiple Windows, I'm on Workspace 1. If I move to another workspace, my webcam follows me. And most of all, I like having my webcam set to a keyboard shortcut. So when I press Mod C, it disappears. When I press Mod C again, it reappears. So I like being able to toggle it on and off. It's really helpful. And it's nicer than some people put the webcam in after they do the video. And I like being able to actually play around with it. Or if I want, I can maximize it or something like that. So how do I actually figure this thing out? I mean, how do I actually configure this in I3? So first off, if you don't know in Linux, whatever webcam you have, you can access it in the same way. So this window down here is actually running just MPV, reading my webcam directly. So in order to do that, let's say all you need to do is MPV and then Dev Video Zero. Now, Dev Video Zero is where your default webcam is going to be. And if I just run that, there's going to be a little window that pops up. Now, mine is going to be floating. That's because of some settings that I put in I3. I'll explain that in a second. But yours is probably going to be tiling by default if you're using I3. So Linux puts all webcams in Dev Video Zero and then one, two, three, et cetera, et cetera. So how do I actually go about configuring this? Now, first off, I have some settings in my I3 config. And that is by default, if you saw my last video on scratchpads, you might be familiar with this. But what I do here is I have settings that are specific to when I run my webcam. That is, this line says, whenever you see a window with a title Video Zero MPV, make that floating. So it's not going to be tiling by default. It's going to be floating. That's all that is. And this line here is make the window sticky. So that's when I move to another workspace, I want my webcam to follow. So those are the I3 parts of it that I actually throw in. Now, the last part, I actually ended up doing this in a bash script because I3 is a little wonky the way it runs bash commands. But let me pull this up. Basically, I'm mapped to mod C, a command that runs MPV with the features I want. And if MPV is already there, it actually closes out this specific instance. Let me show you how that works. It's just a toggling the land. So if I pull this bash script up, so this is the bash script I have mapped to mod C. Now what it literally does is, I assume most of you know bash, but if you don't, what this says is try and kill the window that's named dev video something. If you can't kill it, run this. And this is the command that is actually important. So MPV, that's of course what's going to be looking at my webcam. And here's the actual webcam. I want the geometry to be negative zero, negative zero. And that means put it in the bottom right corner. So positive zero, positive zero would be up here or something like that. Or I think the syntax is a little different in MPV. But negative zero puts it down here. And that's exactly what I want. In this part here auto fit, what this says is I want the webcam to take up only 30% of the screen and no more. So the widest part here should take up 30% of the screen. Now why don't I just specify pixel value? It's because sometimes I'm using bigger screens. Or sometimes right now I'm on a laptop, sometimes I'm on a bigger desktop computer or something like that. So I want it to always pretty much be the same proportion. So that's that, right? So this command, functionally if I run this bash command, so if I just say cam toggle, it's going to try and kill the webcam. And if it can't kill the webcam because it doesn't exist, it's going to actually run the webcam. That's all it is. So this is the command that I actually have mapped in i3. Now you might ask, why don't you just put this in the i3 config? It's just one line. Why don't you just set it to run this bash script? Now to be honest, i3 confuses me sometimes. i3, someone can probably explain why this is, but i3 has a lot of trouble with the or operator. It does sort of make sense if you think about it, but basically you want a separate script running this, otherwise i3 gets confused. It's not going to actually run this if it doesn't detect something. So I'll also say this command p kill so that it's looking specifically for anything named dev video. And I don't specify dev video zero. So if hypothetically I have multiple webcams, it's going to look for any other webcam that happens to be open just to be clear. But so this is all you really need for the kind of setup I have. Now you can play around with this, you can put the window in different positions, you can make it have a different size or something like this. Another thing that I haven't implemented yet but I might later is you can get rid of the bindings in MPV because right now if I press like bindings to go forward or back, it actually messes up because it's sort of hard to go forward or back when you have like a webcam. But I'd like to be able to disable the webcam bindings on this thing, but right now it works just fine. It's just every once in a while I'll accidentally press forward or something like that accidentally. But yeah so that's pretty much it. So hopefully those of you who use webcams, I hope this helps out. But those of you who didn't, I hope you learned something about i3 or I don't know something or other. You know that's how you actually learn things. You don't actually like look them up in the book because you never know what you don't know. You just sometimes you got to listen to random stuff and you learn crazy stuff. So anyway I'll see you guys next time. I hope you learned something.