KDE - How To AutoStart Programs

I read a few posts on how to automate the launching of programs or applications when you log into your system. Many were confusing, some where misleading and will not work. Some suggest putting an entry in .bashrc. Fine, but what happens if you don't start your X system? I sometimes run with no GUI, just working on the console. If its an X app it will try to launch.

Admittedly it will work once X is running but you hit another problem. Each time you start an XTerm, you launch another instance of the program.

Another suggestion was to add the entry to .profile. Again this is fine if your running X. If not, same problem as above.

To get an X11 application to launch when you start KDE, go to your home directory. Find the hidden KDE autostart directory .kde/Autostart:

cd /home/myname/.kde/Autostart

Find the location of the program you want to start. If you want to start Emacs, type:

which emacs
/usr/bin/emacs

The system will respond with the location of emacs. (or whatever program you choose). Create a symbolic link to the binary (program) location:

ln -s emacs /usr/bin/emacs

Check the directory and you'll see the link you've created:

ls
emacs@

Do a long listing:

ls -l
emacs -> /usr/bin/emacs

Log out of KDE and log back in. Emacs should launch when the desktop loads.