Multi-Monitor setup was just wrecked, any way to recover the old config?

So… I’ve had 2 monitors working for a long time, and now I also got the TV plugged into the PC… that worked great. so far.

I wanted to play some media on the TV so I installed Kodi which I used a ton before. Inside Kodi I tried switching to a different monitor (via Video settings), which already got a little weird because it stayed on the primary monitor while just reducing or increasing resolution of the Kodi application itself. I then tried the “blank other displays” option in Kodi and that’s when things went sideways…
So first off after disabling the option again, the other displays didn’t turn back on. I then went into the KDE system settings -> display and re-enabled them. Problem is that now the configuration for the second monitor and the TV seems to be swapped and I can’t seem to find a way to swap it back.
I tried enabling and disabling the displays in the right order, disconnecting the TV, rebooting, all kinds of things.
What I mean with swapped is that the task bar that is supposed to be on the second monitor now seems stuck at the TV even after unplugging it. Wallpaper is also also swapped, which is how I noticed it in the first place…

Any idea on how to revert this without having to set up all the KDE panels myself again? I can’t seem to find KDE’s settings directory either.
What I found is ~/.local/share/kscreen, with a bunch of files that seem to be the configuration for the monitor arrangements. But I don’t know how KDE determines which one to use. From the filenames I could also imagine it’s just hashing the monitor EDID’s to figure out the attached monitors or something.
Either way, no idea what to do here to revert whatever Kodi did with the “Blank screens” option :frowning:

Oh yeah, sound was also fked up until I rebooted (seems like it was speeding up everything …), but it’s working now.

I have only used KDE once or twice, I’m not the best person to answer this. However, if you list the contents of kscreen (I believe there’s a config file), I’ll see if I can’t help you out.

[[email protected] kscreen]$ ls -alh
total 44K
drwxrwxr-x.  2 tarulia tarulia 4.0K Oct 22 20:33 .
drwxr-xr-x. 70 tarulia tarulia 4.0K Oct 21 22:29 ..
-rw-rw-r--.  1 tarulia tarulia 1.1K Sep 10 17:43 0e96cb43075b7bfc971356527ab2ba0e
-rw-rw-r--.  1 tarulia tarulia 1.1K Oct 23 00:37 2b448d40e7871417a1aa9ab4223a8d63
-rw-rw-r--.  1 tarulia tarulia  513 Oct 22 20:34 2df366bc28fab11af7a437054d0393f3
-rw-rw-r--.  1 tarulia tarulia 1.0K Apr 21  2019 32b869a262173798dbb1ed37b4f32b62
-rw-rw-r--.  1 tarulia tarulia 1.1K Jul  2 11:01 3e1d7169dbb6b89cfbf1708305a037a3
-rw-rw-r--.  1 tarulia tarulia 1.4K Oct 22 20:06 52cc9281102f477822646822060b68c7
-rw-rw-r--.  1 tarulia tarulia  536 Sep 29 14:58 68f298d18347d037c94962a5e1b79154
-rw-rw-r--.  1 tarulia tarulia 1.1K Jul 25 17:22 8e60658ffcbfc6645e9a58e929f163c5
-rw-rw-r--.  1 tarulia tarulia  499 Apr 25 22:36 97169df8c8f78f8dee6b6afa4e4f1839

each of the files looks similar to this:

[[email protected] kscreen]$ cat 52cc9281102f477822646822060b68c7 
[
    {
        "enabled": true,
        "id": "dd7f9b03014698db836f9a403f1d11dc",
        "metadata": {
            "fullname": "xrandr-AORUS AD27QD-19200B000517",
            "name": "DP-2"
        },
        "mode": {
            "refresh": 143.97232055664062,
            "size": {
                "height": 1440,
                "width": 2560
            }
        },
        "pos": {
            "x": 1440,
            "y": 0
        },
        "primary": true,
        "rotation": 1,
        "scale": 1
    },
    {
        "enabled": true,
        "id": "2647780002ae4a0cffb7e621f88b12d3",
        "metadata": {
            "fullname": "xrandr-Samsung Electric Company-SyncMaster-HMEQ827806",
            "name": "HDMI-1"
        },
        "mode": {
            "refresh": 74.98442840576172,
            "size": {
                "height": 900,
                "width": 1440
            }
        },
        "pos": {
            "x": 0,
            "y": 540
        },
        "primary": false,
        "rotation": 1,
        "scale": 1
    },
    {
        "enabled": false,
        "id": "d601cd92b107bdfe0cf50a3539f4b292",
        "metadata": {
            "fullname": "xrandr-LG Electronics-LG TV-16843009",
            "name": "HDMI-2"
        },
        "pos": {
            "x": 0,
            "y": 0
        },
        "primary": false,
        "rotation": 1,
        "scale": 1
    }
]

Each with different configs for different arrangements. The only issue is that I don’t know how or where KDE chooses which file to use.
Also don’t know if that would even solve the issue.

Based off of what I understand, you should be able to restore your previous configuration by using the command:

kscreen-console --config Insert-File-Name

You will know which config file to load based off of the time/date returned by “ls -alh”

If you cannot find the right config file, manually editing one should be relatively straight forward. e.g. changing primary display.

If none of these options work, you can remove all the config files from the kscreen directory and start fresh (probably requiring a reboot).

rm -r ~/.local/share/kscreen/*

Let me know the results. :slight_smile:

Sources:
http://manpages.ubuntu.com/manpages/trusty/man1/kscreen-console.1.html

https://community.kde.org/Solid/Projects/ScreenManagement

Thanks I’ll try that later on

I figured that too, but I assume then I would have to set up all the widgets again, which is what I wanted to avoid. I’ll probably mv them to the home-dir or something instead so I can restore them if it doesn’t work.
Well, I only have the task bars really, but I don’t think it’s intended having to do them over again. So it’s also sort of a learning thing

The panels and widgets seem to be stored separately. I don’t think kscreen has any impact on them.

Well… yes, but what I’m worried about is that the panels might be stored separately, but how does it assign the panel configurations for a configured monitor to a physical output?

I mean I assume the panel configuration is a set of settings, which is then applied to a physical output… somehow.

That’s pretty much what I’m wondering from the start… because presumably I would just need to switch the 2 monitors in whatever configuration this is stored in.

So moving the files didn’t work. I moved the directory, shut down the PC and started it again. So it should have been clean I’d expect.

On boot it also asked me how the screen layout it. Interestingly the filename for the layout it created is the same as one of the old ones, so I assume it is some kind of hash, the file contents differ though.

Going to move/copy the old files back and try with the kscreen command.

That also makes me wonder how to get rid of the old config though since I don’t know if any of it is still being used and just not visible due to an “invisible” monitor…


Just tried the console, and this is weird:

[[email protected] kscreen]$ kscreen-console --commands
Unknown option 'commands'.
[[email protected] kscreen]$ kscreen-console --config
Unknown option 'config'.
[[email protected] kscreen]$ kscreen-console --help
Usage: kscreen-console [options] bug|config|outputs|monitor|json [args...]
KScreen Console is a CLI tool to query KScreen status

Commands:
  bug             Show information needed for a bug report
  config          Show KScreen config files
  outputs         Show output information
  monitor         Monitor for changes
  json            Show current KScreen config

Options:
  -h, --help  Displays this help.

Arguments:
  command     Command to execute
  [args...]   Arguments for the specified command

also tried kscreen-console config because it’s listed as a command, not an option, but that’s not it either


after some more digging I found where Plasma stores the panel configuration, but it’s not exactly straight forward… It’s one big configuration file: ~/.config/plasma-org.kde.plasma.desktop-appletsrc. It has literally everything in there… just really need to figure out how to swap the monitors…

Nice! I found it! Using a separate post so I can pin it as a solution on the top:

The relevant config-file is located here:

~/.config/plasmashellrc

It’s a simple text file so just open it up. Somewhere in it you fill find a section similar to this:

[ScreenConnectors]
0=DP-2
1=HDMI-1
2=HDMI-2

For me the identifiers 1 and 2 were mixed up. I swapped them, saved, rebooted, and it was fine.

Presumably I could have just swapped the HDMI connectors on the actual GPU. However I am pretty sure I didn’t swap them initially, so I don’t know why they got mixed up in the first place.