KDE will launch programs configured in the configuration files within the Autostart directories whenever you start your KDE session. You have the option to launch normal programs or to launch shell scripts, be it Bash, zsh, or other shell script types. You can also configure the scripts to execute during session logout.
If you need your script or program to launch during other stages of Linux startup, you can look into crontab or systemd.
You can create these configuration files manually, or you can use the provided Autostart tool from KDE's System Settings.
Steps to configure autostart program for KDE:
- Launch System Settings from the launcher.
- Go to Startup and Shutdown from the sidebar menu.
- Click on Autostart on the sidebar.
- Click on Add button at the bottom of the screen.
- Click on Add Application to add program to launch during KDE startup.
- Filter and choose application from the list and click OK.
- Click on the Add button again to now start adding shell script.
- Click on the Add Login Script button to add shell script to automaically start during KDE startup.
- Browse script using the file picker and click Open.
By default it is set to create a symlink / softlink to your actual shell script.
Make sure the user has execute permission on the script or application.
Related: How to change file and folder permissions in Linux
- Launch terminal.
- Check content of generated Autostart desktop file.
- Check generated softlink in Autostart script directory.
Comment anonymously. Login not required.