How To Autostart Programs On Linux
Вставка
- Опубліковано 18 вер 2024
- How do you "autostart" programs on Linux? While the big desktop environments (like GNOME and Plasma) simplify this, knowing how to setup your autostart programs is especially important for standalone window manager users. While there are a number of ways to do this, I'm going to show you the two ways that I use.
WANT TO SUPPORT THE CHANNEL?
💰 Patreon: / distrotube
💳 Paypal: www.youtube.co...
🛍️ Amazon: amzn.to/2RotFFi
👕 Teespring: teespring.com/...
DONATE CRYPTO:
💰 Bitcoin: 1Mp6ebz5bNcjNFW7XWHVht36SkiLoxPKoX
🐶 Dogecoin: D5fpRD1JRoBFPDXSBocRTp8W9uKzfwLFAu
📕 LBC: bMfA2c3zmcLxPCpyPcrykLvMhZ7A5mQuhJ
DT ON THE WEB:
🕸️ Website: distrotube.com/
📁 GitLab: gitlab.com/dwt1
🗨️ Mastodon: fosstodon.org/...
👫 Reddit: / distrotube
📽️ LBRY/Odysee: odysee.com/@Di...
FREE AND OPEN SOURCE SOFTWARE THAT I USE:
🌐 Brave Browser - brave.com/dis872
📽️ Open Broadcaster Software: obsproject.com/
🎬 Kdenlive: kdenlive.org
🎨 GIMP: www.gimp.org/
💻 VirtualBox: www.virtualbox...
🗒️ Doom Emacs: github.com/hli...
Your support is very much appreciated. Thanks, guys!
Great explanation for auto-starting! I have to admit, I'm one of those users that never did it this way. 👍👍
KDE user here. I love how simple the autostart program is 😁 autostart my dock, my Konsole, my Backup application. Nothing more, nothing less. No kruft, all easy.
Thanks for showing us some more ways to make it work on other desktops!
I use xinitrc and have ever since I ditched the display manager. You can even automate the "startx" command to trigger every time you log into the tty, making it behave more like somewhat of a DM.
Same, it's much better this way. However I place my apps on my .xprofile to keep my .xinitrc more organized
Is there a way of using xinitrc with a display manager? I wanted some script to run after I select the dwm window manager through a xfce login, but I do not know how I can do that
I have tried using a script in the dwm.desktop file, yet it could not find the file, sometimes it simply returned to the xfce login screen instead of opening the dwm window
@@lucasrodrigues9766 Try using a .xprofile file. They are supported by most DMs
@@Tjk918 thanks
like your tutorials alot, simple and to the point thanks
This is really great information thank you Derek. I want to start the proper screen resolution for each window manager and this clearly explained it.
I really needed this one. Thanks
Hey Thanks,
You uploaded it just when I neeed it.
Yes.. i just search it yeaterday and gone nuts as things put in xinitrc not starting....
🙃i just wanted compton and wal to start but not from WM config file... that is not working sometimes
Well, .desktop files have an option to run commands in the terminal so, yes, you can put the Htop desktop file in your autostart folder and it will work.
If you're using a GUI desktop file editor it should be a checkbox saying "run in terminal", if editing it manually with a text editor, it's a line saying "Terminal=true" (or "false").
What a great topic! I've been wondering if removing an app got everything out and, thanks to your video, I found that there are actually leftover .desktop files laying around on my system. Well, no longer! Kudos, Derek ;)
Thank you, my friend! It is equal in Windows, just Win+R shell:startup to acess the folder
What about `/etc/init.d` or the `/etc/rc*` scripts and directories? How do you decide between using these, or the autostart files you mentioned in this video?
Great video. Thanks for the really good, in depth explanation of how these things are really meant to work. It's nice to get some light shed upon the situation.
Been using Linux (Thank you God!!) for year now and I know how to "startup" auto-start. Tq DT.
Thanks for the morning video DT!
In order to connect hardware and software in the correct order, it is important to be able to schedule the start-up of the components. Linux Mint has made it easy for the user by specifying a delay when specifying the startup programs! How do you do in other Distros that lack this?
Which software specifically? I had no issue without any auto starting programs except systemd services.
@@glidersuzuki5572 Hello,
Sometimes it is important that the start-up takes place in a predictable way and not randomly. Same every time. Simple example: That the network works and the server is up and running. Then the synchronization software in the computer can be started. The alternative without a specific starting order, I get error messages and problems! Guaranteed! The computer I am currently running has four servers and three clouds connected. The mutual starting order is essential. You do not want some system programs in the early start-up. For example, "Update Manager", "System Reports Manager" and "Panel Program for Print Queue". These are delayed by default in Linux Mint. Anyway, it's so easy to work with the boot order in Linux Mint so you can treat yourself to that luxury! (More complicated cases exist of course) 🙄
systemd is made to solve that problem. though probably a bit complicated and need some time to read the manual for new users.
@@rizkyadiyanto7922 Or you could just have a directory of init scripts, with names that started with 01, 02, 03, and so on. Not complicated, no need to read a manual, things running in a specific order every time.
@@rizkyadiyanto7922 On my mythtv system I have an overide file: mythtv_backend_override.conf that tells systemd not to start mythbackend until the hardware tuners have initialised
This is what i needed. Thank you so much!!
Good video.
Does it have to be .desktop files, or can it be soft links? Because these desktop files already exist, no? I know they're small, but they get updated when you update, and copying them around always seems to cause problems, like icon file names being changed, etc.
What is wrong with using .xprofile? When using .xprofile, I do not need to make desktop files for all my scripts and programs that do not have desktop files (a lot of programs I use do not have desktop files)
Unlike .xprofile and older methods (like .profile), xdg-autostart works with Wayland too. Some people use Wayland instead of XOrg.
Thank you for making this video.
that's exactly what i need how do i auto-start a terminal program in Linux inside mi desktop environment
"Pro-tip: Have mpv play an autostart sound when you login" 🔥 -DT
Hi, when I open Kali Linux The terminal and Firefox browser open aromatically, how can I disable them when I boot? Peace ✌🏼
I will make EKOS - Emacs King OS, here the features.
Muli ISO - KDE, XMonad, BSPWM, i3WM, EXWM
Super Easy - It will have a keybinding sheet that can be pulled with one key or button on the bar, all programs will be documented on the wiki too.
Just works - It will be Fedora based prob, stable, up to date packages also.
No proprietary software - Free operating system.
Software:
Fish shell
Emacs (optional)
Ungoogled Chromium
Neomutt
SCIM
Dmenu/Rofi
Etc..Etc..
Combo DTOS LARBS.
The Name EKOS is allredy in use by a company
DT, how are you? A been using linux for 10 years or more, another way not discussed very much among users and maybe you can talk about it is creating auto run scripts using systemd and init.d as it is very easy and insane powerfull. I used them a lot as they run in sudo mode you can do lot of things during linux initialization. Good vibes, i see some of your videos some times, good contribution to the linux comunity from your side Regards!
Any way to add a 10 second delay to an autostarted app? Like if you need internet connection before the application starts?
If you use systemd (which is likely), you can create a custom service (a "unit file") that launches your application, and set it to run only after the system reaches a particular "checkpoint" (technically known as a "target"). One of those built-in checkpoints is `network-online.target`, which pretty much means what it says.
That's the clean way to do it IMO. There's also the quick and dirty way, which is to edit the `.desktop` file, and simply insert `sleep 10s && ` after `Exec=`...
I'm confused. Can't you write a bash script and make that autostart somehow?
Even on tiling wm we rely on premade solution like exec_always on i3
Awesome new upload!
I thought systemd (systemctl --user) would be part of this video.
Hey @DistroTube for starting the Emacs daemon I'd consider a systemd unit since you'd have a lot of control over it to restart the daemon in cases like major updates to the Doom plugins for instance.
This topic needs a mention of start on power on vs start on log-in.
Useful advice.
Thank you!
Hey DT, I feel that astro vim beats doom emacs
the problem with linux is ive been looking for 45min on how to start synergy on boot up and its 1 check box in windows.
There actually many other way to auto strart things. The two main solution are the systemd service management (if you have systemd of course) and the crontab for task scheduling. In fact crontab is more powerful than that. You can schedule script execution per week month day or per hour minutes and seconds. And also schedule task on reboot shutdown and things like that.
Does anyone know how to open a program in qtile but in the selected workspace?
Awesome, I've found that the on screen keyboard starts up as a background process on login for me, never use it so will see if I can stop it.
How do you get new programs to run? Do you have to make them executable first, and what is the right way to do that?
Hey DT, what’s your take on ed the Unix line editor?
Hey DT how do you handle with programs/software not made for Tiling Window Manager. Like: MegaSync, Steam, Flameshot, etc ?
How would i autostart a shell script? i don't suppose dropping the sh file into the autostart folder would work?
You could probably just add a .desktop file for you shell script. Make sure that the 'exec' line within the .deskop file points to your shell script.
As DistroTube said you need to create a .desktop file to start your script. This is an example desktop file:
```
[Desktop Entry]
Type=Application
Name=CustomScript
Exec=/bin/sh /home/user/.config/autostart/script.sh
StartupNotify=false
Terminal=false
```
`Name` can be anything.
`Exec` specifies the command that should be executed. `script.sh` is a "sh"(Bourne Shell) script so I'm using `/bin/sh` to run it. If it's a "bash" script I'd use `/bin/bash /home/user/.config/autostart/script.sh`
`Terminal` if set to `true` will open the default terminal emulator app and launch the script in there. In most cases you don't want that so it should be set to `false`
thank you so much
Here to hear if it's init scripts, systemd services, XDG autostart, xinitrc, dot profile, or what am I missing?
Why the heck WM have autostart capability. While i somewhat understand they provide shortcuts, the autostart though? How is it related to "managing windows"...
How to autostart programs if we are using a raspberrypi lite?? Kindly guide
Semi Newbie with a question. Curious if there is way to dictate which workspaces a program opens up in. I would like to group certain apps to certain desktops. I realise that it's probably different per WM but I wanted to know if its doable at all.
I am using the old skool method, the .xinitrc. It can be as simples as a single line in the .xinitr rc ..
emacs -fs
Xorg will run GNU Emacs in full-screen, when start the X11 Window session with 'startx' from text console. Yes, I am still using the old skool 'startx' method. Anyway, my basic .xinitrc just like this.
# Set resolution
xrandr --output HDMI-1 --mode 1920x1080
# Set the beautiful full black wallpaper for 'root window'
xsetroot -solid black
# Enable auto blank and monitor's energy saving mode
xset +dpms
# Start st terminal emulator with GNU Screen
st -g 90x25+0+0 -e screen -Rd&
# Finally start my favorite minimalist window manager.
evilwm -snap 5
I really like that shirt, can you give the link ?
I want application to auto start without need to login in the system.
Could you add this wallpaper to your wallpapers GitLab repo please?
surprised that systemd wasn't mentioned
Is there a way to do this with Hyprland?
I'm welling to try dtos on a vanilla arch install maybe
When I installed CoreControl I was following a youtube tutorial in which it was supposed to configured to autostart, that problem was that I didn't get to autostart the program whichout asking me for the user password. That was hella annoying because I have to enter the password to log in and then enter the password again because CoreControl was asking for it when was autostarted. It's sad that I didn't get an answer in this video for those types of programs that ask for user password whenever they are started.
Hi DT . I have a Corsair keyboard and I use CKB-NEXT and I use the terminal command for systemctl enable . I think this just creates an auto start file into the same directory.. Is there anything I should know about using this command instead of just dragging and dropping the files into the directory?
It is just using systemd to do it for you.
* `systemctl --user start/enable` - starts a systemd service / makes a systemd service start on user login. User specific systemd services are located in `.config/systemd/user`
* xdg-autostart i.e. the thing that reads `.config/autostart` and starts the programs in there is another way to autostart apps. Every modern DE is programmed to scan that dir for .desktop files and start them when the DE is started.
These are 2 ways to autostart a program on login as non-root user. Systemd services are more advanced though and can do more that just start programs on login. You can specify start order, dependencies and more.
can i do this with steam big picture moad
How to autostart an application on torizon OS
I still after watching all these videos on how to do it can't get terminal to open up and run bpytop on startup on Linux Mint. Seems simple, but yeaaahh. I created a .desktop file for it and put in:
[Desktop Entry]
Type=Application
Name=bpytop
Exec=bpytop
StartupNotify=false
Terminal=true
and put it in the .config/autostart directly. It shows up in the gui when turning on and off autostart items, but it doesn't seem to run. Even after making it executable. Shrug.
Auto start sound "Welcome you have mail"
Does DT OS include this very same setup DT uses? Thanks.
Yes
I have an autostart script that gets executed by qtile on startup with a method I got in the docs. There's a problem tho. Things started with that scripts do not get killed when the session ends, so logging out and logging back in results in duplicate applications/scripts running in the background. Do you know how I can fix this? Maybe making desktop files for the programs instead of running them with a script, and then using dex to launch those would work?
Just have the script check to see if the thing is running? " if ps -ef | grep -v grep | grep firefox; then echo 'firefox is running'; else echo 'firefox not started yet'; fi " kind of thing?
systemd
G. Nome sound so wrong 😂 I don’t know official name but I just assumed it was like the English word gnome with silent G
Create a desktop shortcut for the app from the menu and copy it 🤪
I just use systemd because its the best!
Hi. What file manager is that?.
Slow down the video and you'll see that Derek is using pcman
@@donpeer4477 Thanks. Looks Nice is why I asked.
I think emacs
It is to avoid those apps
Well I'm guilty of using Cron inwtead
Yeah, working for other people sucks.
Too much talk.
"GAnome"
おはようございます
first
youve wasted my time
As usual - simple thing that is made needlessly complicated on Linux.
agreed
How so?
Lol. How is it complicated? If you want it easier use KDE or some. Yet another idiot filtered by change, when there is a million ways to do it and way easier than Windows.
Create a "oneshot" .service file. /etc/systemd/system/.service
systemctl enable .service
This is bloat. I just insert "program &" to my ~/.xinitrc
AwesomeWM users probably need to put their autostart entries in the rc.lua, as AwesomeWM does not respect ~/.config/autostart and /etc/xdg/autostart
@Spada I am an AwesomeWM user and I always had this issue
@Spada Awesome is the only tiling manager that I have tried. So, I am not sure how it compares to other managers.