How to automatically run program on KDE startup

KDE looks for programs in the ~/.kde/Autostart directory to be executed during it’s startup. The way to execute programs as KDE starts would be to;

  1. Copy programs directly to the directory
  2. Create (soft) link to programs from the directory
  3. Create a script which will execute other programs

The first method is very straightforward, and the second method can be achieved using the ln command. The following example is to run superkaramba as KDE starts.

$ cd ~/.kde/Autostart/
$ ln -s /usr/bin/superkaramba mykaramba

The third option is my personal favorite, as it provides a great level of flexibility. The following is an example bash script placed in the ~/.kde/Autostart/ directory to run gpg-agent, export a variable, and start the program katapult and conky;

/usr/bin/gpg-agent --daemon --use-standard-socket &
export GPG_AGENT_INFO=/home/shakir/.gnupg/S.gpg-agent
/usr/bin/katapult &
/usr/bin/conky &

Please make sure all programs are executable by running chmod, probably as the following example;

$ chmod +x ~/.kde/Autostart/*