 How do you auto start programs on Linux? This is something of course, new to Linux users are going to be confused about, but really people that have used Linux for years in many cases don't know how to properly auto start programs, especially in standalone window managers. And the reason for this is because the big desktop environments like GNOME, KDE Plasma, they kind of take care of this for you. They have built in programs in those particular desktop environments to auto start programs for you. So you go to their auto start applications program or whatever they call it in GNOME or KDE Plasma, and then you tell it the programs you want to auto start. You give it a command to execute every time you log into your desktop environment. For example, say I want to auto start Firefox. I just tell GNOME's auto start applications thingy, I tell it to execute the command Firefox every time I log into GNOME. That's how these things work. And that's why when you log into your full desktop environment, typically you have a bunch of stuff already sitting in the system tray. Those programs were auto started by your desktop environment. It's things like your volume manager, your clipboard manager, your network manager. You know, you see all those icons sitting in the system tray. Those are programs that were executed, though they sit in the sys tray because that's the way those programs are designed. But those programs had to be launched by somebody or something and they were launched by your auto start program. Well, what happens on a standalone window manager? Maybe a floating window manager like Openbox or standalone tiling window managers like I3, Awesome, DWM, X-MODEM. How do you auto start applications on those? And that's what we're going to talk about today because I think there's two correct ways to do this. There's many ways to do this, but I think two ways that I'm going to show you today are what I consider the proper ways to do this. So let me switch over to my desktop and I am using X-Monad, a tiling window manager. At the top, you can see my panel. This is the X-Mobar panel. And then you see I have a system tray off to the side of the panel. This is a standalone system tray. It's actually not part of the panel. This is called Trayer. And in the system tray, you see I've got six things running. The first icon is OBS, which I used to record these videos. But the other five icons, these were all programs that auto started when I logged into X-Monad. So I've got MailSpring, my email client. I've got a volume manager, a network manager. I've got the library application, LBRY. And then I've got NextCloud that auto starts when I log in. So how do these programs get auto started? Well, if it's a program that you want to auto start, no matter what window manager or desktop environment you log into, which is usually the case. What you wanna do is, let me open a file manager here. You wanna make sure to go into .config slash auto start. So in your home directory, you should have a .config directory. .config is where, of course, config files should live on your system. And in .config, you should have auto start. Now, this is a standard. This is actually a Linux standard, part of the XDG desktop specifications. And you can see in my case, there is library, there is MailSpring, and there is NextCloud, which were three of the programs that I specified to auto start when I logged in. Now, obviously there were two other programs that auto started because I mentioned the network manager and the volume manager. How did I get those to auto start? Well, let me show you my Xmonad config because I mentioned there's really what I consider two correct ways to do this. So if it's a program that you want to auto start, regardless of window manager or desktop environment, put the .desktop file for that program in .config slash auto start. But if it's a program that you want to auto start, specifically on the window manager that you're using, what you should do is go into that window managers config and every window manager should have a way to launch programs as soon as you log in. In Xmonad's case, I have a startup hook here, I call it my startup hook. And all I do is run the commands spawn. Spawn in Xmonad means run a program. And what I'm gonna do is I'm gonna spawn LX session, which is my desktop session, the Paul Kitt session manager, PyCom, which is the compositor that gives me transparency and fancy effects and stuff in Xmonad. And then network manager applet. So that is why that gets launched. And then volume icon, that's why that gets launched. And it also spawns the Emacs server, the Emacs daemon. Now I'm not going to open up every single window managers config file that I've got installed on my system and show you how to auto start programs in each config because it'll be different for every window manager depending on what language they're written in and things like that. But know that every window manager should have a way to auto start programs within their config. But if it's something that you want to auto start regardless of window manager, just throw the .desktop file for that application in your home directory slash .config slash auto start. Now you're probably wondering, okay, well, where do I find the .desktop files for these various applications? Well, they could be in a lot of different places on your system. So I'm gonna open up a terminal, make it full screen, zoom way in. I'm gonna do a sudo find and I'm going to sudo find enroute, that's the slash. So in the top level directory dash I name, that's an insensitive case name search. And I'm gonna search for every file on the system that ends in .desktop. The asterisk is a wild card. It means any file name .desktop. And this search may take a while since we're gonna search the entire file system. And it returns a lot of stuff. So there's a ton of .desktop littered all over the place on your system. Obviously it looks like flat packs, many of them include a .desktop file within the flat pack. I know app images typically do, I think snap packs typically do. Yeah, if I go scroll through the snap stuff. And then you see .local share applications, that particular directory on your system. That is a place where many applications put a .desktop file. So let's actually go into that. So I'm gonna go into the home directory. Let's go into .local share applications. And that particular directory is nothing but .desktop files. So if the program you're looking for happens to throw a .desktop file in there, all you would need to do, or example, Htop, I wanted Htop to auto start. I don't know if that would work since it's a terminal program, but let me pick something else. LibreWolf, this particular .desktop file. Here I'm gonna copy that, so control C. And then let me go back into the auto start directory and then control V to paste. And I put the LibreWolf .desktop file there. So now when I log in to Xmone Adder, any window manager, it doesn't matter because remember this is for any desktop environment or window manager for your user because obviously it's in your user directory. So it's not for every user on the system, it's just for you. But it doesn't matter what you log into now. LibreWolf should auto start whenever you log in. Now I don't want LibreWolf auto starting every time I log into my various window managers. So I'm actually gonna close that out. So something again, it's a simple thing, but I know a lot of Linux users actually don't know about that particular directory. Now there's actually two directories for auto starting programs that are Linux standards. I mentioned .config slash auto start, that is for a specific user, which is what most people are gonna want. Now if you want to auto start a program for all users on a system, it obviously needs to go in the root file system, it needs to go in slash etsy slash xdg slash auto start. Now one of the reasons I'm bringing this up today is not just the fact that people need to know how to auto start programs, but also people sometimes need to know how to auto start programs, because I get a lot of questions, especially here lately, because I do my ArchPost installation script, DTOS that installs my Xmonad desktop environment, and people install this on various arch-based distributions such as Arco and Manjaro and Endeavor and Garuda, and people try this out, and then when they first launch into my Xmonad desktop environment, instead of seeing all the stuff that I've set to launch, they get all of that stuff, but then they also get the welcome screen for Arco, or they get latte docker, or a cocky that is not a cocky of mine, they get a bunch of things that all of a sudden pop up all over the screen, a drop down terminal that wasn't part of DTOS, and they're wondering, why is all of this stuff happening? Is the DTOS script broken? No, there's nothing wrong with the script. Everything that I told it to install, installed just fine is just because you had already installed a Linux distribution that was highly customized, Garuda, Arco, Manjaro, they've already pre-installed some things into your auto-start directory. So what you need to do is go into dot.comfig slash auto-start and remove whatever happens to be launching on its own that doesn't belong, for example, that cocky or that dock, or whatever it happens to be that's appearing on the screen. So that is what was the catalyst for the late of me making today's video. And before I go, I need to thank a few special people. I need to thank the producers of the show, Devin Gabe James, Maxim Matt, Michael Mitchell, Paul Scott, Wes Allen, Armor Dragon, Chuck Manderangio, Daniel George, Lee Lennox, Ninja, Mike, Erion Alexander, Pete Sarchivinura, Polytech, Red Prophet, Steven and Willie. These guys, they're my highest tiered patrons over on Patreon. Without these guys, this episode would not have been possible. The show is also brought to you by each and every one of these ladies and gentlemen as well. All these names you're seeing on the screen right now, these are all my supporters over on Patreon because I don't have any corporate sponsors. It's just me and you guys, the community. If you like my work and want to see more videos about Lennox and free and open source software, subscribe to DistroTube over on Patreon. Peace guys. Pro Tip, have MPV play an auto-start sound when you log in.