NB: make a backup first
cp ~/.config/plasma-org.kde.plasma.desktop-appletsrc ~/.config/plasma-org.kde.plasma.desktop-appletsrc.bak
OVERALL BUG DESCRIPTION
Assume one performs the following actions: attaches a new second monitor -> attaches the old second monitor.
After this procedure the 'screen id' of the old second monitor gets corrupted. You see no taskbar (a panel), the wallpaper has been reset, etc.
Below steps refer to the file ~/.config/plasma-org.kde.plasma.desktop-appletsrc (thereafter SETTINGS_FILE)
HOW TO FIX
I. FIND OUT SCREEN IDS OF YOUR MONITORS
- Change desktop wallpapers at the both screens, e.g. foo.png for monitor 1 and bar.png monitor 2.
Below is described to how find the screen ID for monitor 1
- Open SETTINGS_FILE
- Find foo.png and bar.png in the SETTINGS_FILE
You will see the following block (for foo.png)
[Containments][2][Wallpaper][org.kde.image][General]
FillMode=6
Image=~/Pictures/foo.png
It means foo.png is part of [Containments][2].
- Thereafter find the following block which refers to [Containments][2]
.
[Containments][2]
activityId=9c23ff19-bffa-4182-bdb6-d9b36dd27cdb
formfactor=0
immutability=1
lastScreen=0
location=0
plugin=org.kde.plasma.folder
wallpaperplugin=org.kde.image
voila, we see the string 'lastScreen=0'. It means the screen ID of monitor 1 is 0 (because monitor 1 refers to foo.png, foo.png refers to [Containments][2], and [Containments][2] refers to lastScreen=0).
The same way you find the screen ID of the monitor 2, say, 1.
So, assume, the screen IDs of monitor 1 and monitor 2 are 0 and 1 respectively.
II. FIND AND REPLACE SCREEN IDS
- Run grep on SETTINGS_FILE
.
$ grep lastScreen= plasma-org.kde.plasma.desktop-appletsrc
lastScreen=0
lastScreen=1
lastScreen=0
lastScreen=0
lastScreen=1
lastScreen=2
lastScreen=1
lastScreen=0
lastScreen=2
lastScreen=1
lastScreen=0
lastScreen=0
lastScreen=1
lastScreen=2
As you can see there are lines with 'lastScreen=2'. These are the corrupted lines.
.
kquitapp5 plasmashell && kstart5 plasmashell
Now, your desktops should be repaired!
1@Pavel, if I remember correctly, I found it like this: jozxyqk's answer lead me to the correct file. I saved my file and used his solution, and then compared the new file to my old file. lastScreen seemed a likely candidate so I tried it (replacing my old file with a change to that one thing). – EricS – 2017-01-01T00:52:41.823
In my case, the "kquitapp plasmashell" command produced an error ("Quitting application plasmashell failed. Error reported was: org.freedesktop.DBus.Error.NoReply : Did not receive a reply ....") and I had to kill the plasmashell. – Daddy32 – 2018-01-31T08:34:20.207
I'm now getting
"Application plasmashell could not be found using service org.kde.plasmashell and path /MainApplication."
. Is there an updated service to restart? – Paradox – 2019-09-19T15:31:01.450