Run Script KDE Plasma at Start

I wish to run a script when KDE Plasma starts.

I would create an executable script put it in a recognised common user folder and configure KDE Plasma to run the script when it starts up.

For convenience I have borrowed the script created for Add Icon for Script to KDE Menu.

The script named audiorestart.sh was saved within the directory /usr/local/bin.

I like to denote shell scripts with .sh extension.

#!bin/bash
systemctl --user restart pulseaudio.service
systemctl --user restart pulseaudio.socket

It was made executable by running

chmod +x /usr/local/bin/audiorestart.sh

Now to run the command when KDE starts

Open the System Settings from the application launcher

From the left hand menu select Startup and Shutdown from the Workspace section.

Click on Autostart.

To add the script click on the button Add Script at the bottom. From the popup dialogue navigate and find the script which we have previously created.

Untick the option Create as symlink.

Click OK to complete.