In this tutorial I’ll show you how to automatically fire up any program or command when KDE starts up. You can create your own launchers (desktop files) to be ran or even Bash scripts with commands to be executed.
KDE has a special directory in which launchers which should be executed are placed. This directory is $HOME/.kde/Autostart by default. You can change this inside the KDE System Settings by going to Account Details and clicking on the Paths tab. Although normally you don’t need to change this, see the screenshot below if you want to set another folder as your KDE start-up folder:
So, the simplest way to include start-up applications is to manually add the launchers or scripts inside this directory.
For example, you can create an application launcher, which actually is a desktop file, then copy the file inside the Autostart directory. If your application is, say, Wesnoth, the launcher may look something like this:
#!/usr/bin/env xdg-open [Desktop Entry] Name=Battle for Wesnoth GenericName=Turn-Based Strategy Type=Application Exec=wesnoth Icon=wesnoth.png
A tutorial on how to create desktop files can be found here. It shows you how to create launchers both graphically and manually by editing the text file. All you have to do after creating the launcher is to copy it inside the $HOME/.kde/Autostart folder.
An alternative way to do this would be to create a Bash script, make it executable and then copy it inside the Autostart directory. You can call your script startup.sh (or anything you desire, as long as it’s executable) and it can look something like this:
#!/bin/bash # Put this script inside ~/.kde/Autostart for KDE4 to launch it at start-up yakuake klipper steam
In the above example, the Yakuake terminal emulator, the clipboard tool Klipper and Steam will all be launched automatically upon KDE startup.
Except for the above method, there is also another way to do this, from within System Settings. To accomplish this, find the Startup and Shutdown section in System Settings and then click the Autostart tab. Here you can click on the Add Program… button, then choose an application to launch from the list that appears:
After adding a program to the list, you can check it was added inside the $HOME/.config/autostart directory as well, the standard, user-wide directory for adding these files.
Are you aware of different ways of accomplishing this? If so, please share them in the comments below.