Check out a free preview of the full Developer Productivity, v2 course
The "Why Use a Window Manager" Lesson is part of the full, Developer Productivity, v2 course featured in this preview video. Here's what you'd learn in this lesson:
ThePrimeagen discusses the benefits of using a window manager to organize windows and streamline navigation, and recommend using tmux and ghostie for a powerful terminal experience. He also highlights the importance of having sessions that persist even after closing the terminal, multiple sessions based on directories, tabs within sessions, and the ability to quickly navigate to sessions using fuzzy find.
Transcript from the "Why Use a Window Manager" Lesson
[00:00:00]
>> ThePrimeagen: So we're gonna kinda move on to a new section, which is called navigation. For a lot of people, I feel you don't think about navigation. I can't tell you how many times I've seen someone do this move on a Mac, all the windows show up, and then they click something.
[00:00:15]
And I get a cortisol response, I actually go into the this anxiety ridden, space, and I'll just be messed up for hours afterwards be how do they live that life? I'm not gonna say it the Twitter way, but they live that life, and that's crazy. And so I can't do it.
[00:00:34]
So navigation, I think, is pretty much the most important aspect of your operating system, comparatively to your dot files. Long as you have a good environment and you can get started really quickly and you never have to think about that again, that's good step one. Step two is how do you get to where you're going?
[00:00:48]
I think that's really important question that people just don't ask, and also don't optimize. To the point where you're trying to solve the point 5% the thing you do once a week, or maybe even once a month. To me, I don't really, I attempt to optimize that, unless, if it really is bothersome.
[00:01:03]
If I do it once a week, but it takes me 30 minutes to do it, maybe I need to think about how can I make this faster? But if I do it once a week and it takes me one second to do it, I have to click one extra button.
[00:01:14]
Just not worth my time, right? And so I always just try to solve that 99%. And I want to be able to do it in one button. That's why I like to be able to go here or here or here. If you notice that when I did the MF Ansible, I was able to just kinda go there really quickly at a nice, fuzzy find.
[00:01:30]
All of that falls under go back to my previous project, which is my dev end. All of that is navigation, right? I wanna be able to go to any project as fast as possible. I don't wanna have to go through this long process of navigating or clicking a bunch of directories in a file tree to go open up a new one and then clicking open and then a new instance comes up.
[00:01:49]
I don't wanna go through all that. I just want it to be fast and just right there, all right? So probably the biggest thing you need to get into, which I don't know how many of you have a win. I see a bunch of mackintoshes as they're called.
[00:02:01]
I think it's yabai y-a-b-a-i, yabai. Is that correct, anyone? There's windows managers. Get a window manager. It's single handedly the most important thing you can do for your life is getting a window manager. Never place a window again. And Mac's default window settings is hands down like an LSD experience.
[00:02:24]
It makes no sense. Everything you're doing is completely bonkers. You go up, it expands this way, but not that. Everything about it is just super inconvenient. There's no ways to place windows nicely. Every time you go to anyone's desktop that doesn't use a window manager, it's just filled with 20 windows.
[00:02:40]
All slightly stacked on each other, all in slightly different spaces, all of slightly different sizes. It's just like, why would you like, I watched my wife do this, and she's like, trying to find stuff, and I'm like, Babe, you're gonna you're killing yourself. Don't do this, don't spend all that mental effort searching.
[00:02:55]
That's just so bad and so don't do that. And so if you're still placing Windows manually. You're living in the Stone Age, that's just a or you're not even living in the stone age they actually had it figured out. You're living in the 1999 era, where they thought everything should be a GUI and everything should be fantastic, right?
[00:03:11]
Stop living in that era, that's a terrible era to live in. Window managers, it's not gonna be a large part of this course, but it's the basis for how I approach everything here. From here on out, I approach things in a very, very simple set, or a very, very simple way, is I want everything to be these progressive squares of getting closer.
[00:03:30]
It's kinda playing golf, right? With golf, you start off with the big club going towards the green. When you're on the green, you're trying to get within a trash can lid of the hole, or in the hole when you're that close. It's an easy put in, right? You're just progressively making your target smaller.
[00:03:43]
And so with a window manager, I want to be able to have one button click and I want to be able to go to say my browser, Chrome. I want to be able to go to my terminal with one button. I wanna be able to go to say my, what happens if I have my Twitch streaming stuff, my Twitch chat or whatever over here.
[00:03:59]
I want each one of those to be one button, and that's it. So that way, when I'm coding, I'm right here, when I want to be here, I'm right here. I'm a one monitor kinda person. I do not like multiple monitors. I find myself just getting super distracted when I have multiple monitors, because it's so easy to be man, there's Twitter, right?
[00:04:16]
You just don't even have it as an option, right? And then it's just really easy. That's me, I have lack self-control. So I control myself through other means. It's very easy for myself. And so this is kinda the approach that I want to take to everything I do.
[00:04:29]
If I can't get where I want to go immediately, then that's like something I want to fix, especially when I do it hundreds of times a day. The amount of times I go from editor to window to editor to window to editor to window. I want that to be fast.
[00:04:44]
There's a good case to be made where maybe that's where you actually want to be able to have the whole split thing. You can do that too. I just typically don't do that, I like that approach. I don't know why, just feels good for me. Maybe it's my StarCraft upbringing.
[00:04:58]
In Starcraft, you have all these different groups. And so I kinda have my different groups for how I want to play and how I want to position. So you gotta have your sneaking in the back of the minerals, doing drops on people one. Then you have also your main army, and then you also have your high Templar one, you gotta play your different moves there.
[00:05:13]
So that's the life I lived. All right, so what is a minute window manager? There's a bunch of them. Usually, they just simply organize where your windows are. I3 kinda wipes out your desktop, so it has a lot more of a say over your operating system than, say, other window managers like Goodbye for Mac.
[00:05:31]
But there's a whole bunch of them, right? Pop OS has its own, I forgot what it's called. I3, awesome window manager. Left window manager, DWM. There's one that has BSPWM, or something like that. There's an absolute mega amount of them. For me, how I use it? I only just want one thing, right?
[00:05:50]
So for me, there's not really a big difference between them, long as I can just go where I wanna go. So I don't really care. I don't care beyond that and you'll notice here that I'm not giving you really any recommendations, because I don't think they're that big.
[00:06:06]
I don't spend a lot of time with a bunch of windows, constantly reorganizing windows. I kinda have one thing that's open and I don't change it again until I turn off my computer, then I return on my computer, and then I have to regroup, go to each window and be I want chrome on number two or Firefox at number two and do that and then that's it.
[00:06:24]
All right, so there you go, I think that's it. You can also have program opener so if you're on Mac, you have magic finder. If you're not on Mac, you can get something like rofi or dmenu that will open up and have effectively the exact same experience. It's a good move, you should definitely have that, and I'm sure there's 100 more of them, because it's Linux, after all.
[00:06:43]
And everybody reinvents, I'm literally telling you to reinvent the wheel also. So if you invent your own, is it the worst thing? Probably not, but I don't know. For me, that's not something I want to reinvent. So it feels a pretty small surface area solve problem. I don't give any recs, because I just don't.
[00:06:59]
For me, it just doesn't matter. I don't see how awesome window manager is gonna make my life any better, or left window manager, or DWM, none of those are gonna make any of my life better. So I just don't care. So therefore, figure out what you like use it.
[00:07:15]
I don't really care what it is. And I don't think you should care that deeply about it, unless if you want to drive a lot of stuff through your window manager. And with I3 you can do that, I could end up making it so that I can have a bunch of special key combos that could change a bunch of stuff, or send out messages up to a server that could say, send it down to my OBS stuff live, and be able to change scenes like I could do all of that and set that all up.
[00:07:35]
I just haven't and so maybe then I'd want to explore a more robust Window manager, but until then, this is perfectly fine. So there you go. That one's done. I just wanted to get that in your head. Go fast, okay? So the terminal experience, which is what I think is probably the most common experience, the thing that we're gonna be using a huge portion of our time as developers, you often will have a server running.
[00:07:58]
And if you're using something like VS code, you have a server running. And I know a lot of people that have to have a second terminal open that they go and they have all of their terminal stuff on, and then they have their editor that they do all their editor stuff on.
[00:08:09]
So having a good terminal experience is highly recommended. And so we're gonna kinda go through what I consider to be a great terminal experience, which are these six things I want sessions to last, even if I close my terminal. I should be able to close my terminal, and it should just keep on running.
[00:08:24]
I want multiple sessions. I want them to be based on directory. I wanna be able to have every single directory have its own set of windows and tabs and everything. So that way, I can have multiple projects running if you need to have that. You can have multiple things in different areas.
[00:08:37]
I want tabs within sessions so that kinda falls into this one, which is I want to be able to have say, Vin, some servers running a little scratch area to be able to execute commands in I want all of them together. I want to be able to navigate to any session with a name instantly.
[00:08:53]
I want to be able to fuzzy, find over those sessions and get to where I want to be as quick as possible. And I want to be able to run a script auto magically whenever I navigate to a new session. So if I open up a new project, I want to be able to execute a script that can set up that project for me the way I like to have it set up.
[00:09:10]
Coz there's a lot of times where you have to run two or three things at once. I'm sure there's a lot of people here that have it so that you have some sort of build service, and then you also have some sort of local. Cool server that also needs to be running and perhaps some other Docker things that go off and run.
[00:09:23]
And then you end up having five things that you're running. So it's really nice if you navigate somewhere, it's just like, and it's running. And now you just have to do your editing. And so that's kinda my mentality here. So I want to be able to have those scripts to be unique per directory or have a general one that just works.
[00:09:39]
Alright, so for this, I choose Tmux. There's good arguments to be made that Wes term actually, is also a really good replacement for Tmux or Zella J I just don't. So instead, I use just Tmux and Ghosty. Ghosty is pretty awesome. The reason, actually, why I use ghosty, which I think.
[00:09:59]
I think I say down, let me just make sure. I don't say it around here. Okay, maybe I say it later. I do say it later, but I'll just say it now. I just think Mitchell Hashimoto is really talented. And so I just use his stuff because I think he's a nice guy and that's it.
[00:10:15]
I use stuff for super lame reasons, if I like somebody, I will go out of my way to just use the thing they make. Coz that person's really cool. I'm just gonna use it coz it's super cool, right? That's it and so I think Ghosty is cool. Coz I think Mitchell's cool.
[00:10:29]
And so even though West term apparently can solve both my terminal and my TMUX, I just keep on using Ghosty plus TMUX coz that's just the way I am.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops