1. Home
  2. Linux

How to fix the KDE Plasma panel crash problem

The KDE Plasma 5 desktop environment is rock solid at this point, and rarely has any breaking issues that make it impossible to use the desktop. However, sometimes, the KDE Plasma panel can freeze up and crash, which is a huge problem.

Unlike Gnome Shell, KDE Plasma 5 has no real built-in restart mechanism for their users to take advantage of. So, if you’re using KDE and you want a quick way to restart a broken or crashed Plasma panel, you’ll need to create your solution. In this guide, we’ll go over how to create a restart tool that can get you out of jams if your Plasma panel crashes.

Restart the panel with terminal commands

KDE’s panel is part of the “plasmashell” process that runs in the background on your Linux PC. So, if you’re having issues with the panel not working, the easiest way to get it back up and running is to deal with that process.

Sadly, it isn’t possible to outright restart the plasmashell process from the command-line. Instead, you’ll need to stop it manually.  The best way to do this is with the killall command, as it will instantly stop every instance of “plasmashell” running. So, open up a terminal by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard and end “plasmashell.”

killall plasmashell

Upon running the killall command, everything will go black. However, you should still have access to the terminal. From here, restart the “plasmashell” process from the terminal. Be sure to add the “&” at the end of the command to send it to the background.

plasmashell &

As soon as the plasmashell command above is run, a fresh KDE Plasma 5 panel will appear on the screen. However, this new panel is dependent on the terminal, since it’s running inside of it. From here, the process needs to be sent to the background. To do this, run the disown command.

disown

Disown will take the “plasmashell” process,  and send it to the background, giving you a fully functional KDE Plasma 5 panel to use once again.

Creating a restart script

Opening up a terminal to kill the “plasmashell” process can be very tedious. It works in a pinch, but it’s not ideal for most users. A great way to restart the panel if it freezes is to create a quick restart script, that can be run.

To start, open up a terminal window by pressing Ctrl + Alt + T and Ctrl + Shift + T on the keyboard. From there, follow the step-by-step instructions below.

Step 1: Using the touch command, create a new blank file in your home directory labeled “panel-restart.”

touch panel-restart

Step 2: Use the echo command below to add a shebang to the top of the script. This command is critical because, without it, your Linux system will not know how to interpret the restart script.

echo '#!/bin/bash' > panel-restart

Step 3: Run another echo command to add the main code to the panel-restart script.

echo 'killall plasmashell;plasmashell &' >> panel-restart

Step 4: Update the permissions of the restart file using the chmod command, so that it can run as a program on your Linux PC.

sudo chmod +x panel-restart

Step 5: Place the panel-restart file inside of /usr/bin/ with the mv command. Putting the file here will allow you to call it as a command, much like any other program on Linux.

sudo mv panel-restart /usr/bin/

Close the terminal window. Then, go to the KDE desktop and press Alt + F2 to open up the Plasma quick-launch window. Then, in the window, enter the command below to instantly restart the KDE Plasma 5 panel using the script we just made.

panel-restart

Upon running the command, your KDE Plasma 5 panel should be ready use!

Adding the script to a shortcut

Want to restart the KDE Plasma 5 panel with the press of a few buttons on the keyboard? If so, you’ll need to set up a custom keyboard shortcut. To do this, follow the step-by-step instructions below.

Note: for more in-depth information on KDE keyboard shortcuts, check out this guide.

Step 1: Open up the app menu, search for “custom shortcuts” and open up the item that shows with that name.

Step 2: Inside of the KDE custom shortcut window, locate “Edit” and click it with the mouse. Then, select “New,” followed by “Global Shortcut,” and “Command/URL.”

Step 3: In the “Comment” area, write “KDE Panel Restart.”

Step 4: Click “Trigger,” and assign the new custom shortcut to your favorite key-bind. If you can’t figure out what trigger action to use, consider trying Ctrl + `.

Step 5: Select “Action,” and write the panel-restart command in the “Command/URL” box.

Step 6: Click “Apply” to apply the changes to your Linux PC.

Close the Custom Shortcut window. Then, press your keyboard combo to restart the KDE Plasma 5 panel instantly.

Leave a comment