Multi-monitor Xsetup script not working after sleep

Moderator note: Moved to a new topic from a post to Display Manager multi-monitor configuration

Hi @petsam

First off, thank you for the wonderful guide! I followed it and it worked like a charm.

When my computer restarts, everything that was on screen 2 is exactly there.

My problem now though is that when the computer goes to sleep and comes back from it, everything is messed again…

Pages and apps opened on screen 2 are on screen 1… actually, everything is on screen 1.

Is there a way to run this script when the computer comes back from sleep? Or before it goes? Not sure.

I found an option to do so in the energy saving menu but unfortunately, it’s not working

Your input is greatly appreciated.

Thank you
Kiril

@d4rk5un
If you have an issue and require assistance, please start up a new thread at Issues & Assistance - Garuda Linux Forum and follow the template. Thank you.

3 Likes

There might be, using a service, but I am not sure whether it would solve the problem you experience. There are several bug reports on KDE multiscreen category, and this is one of them. When unplugging a monitor in Plasma session, all components (windows, panels, etc.) automatically move to the existing (primary?) monitor, while they won’t automatically move to the original monitor, if/when it is re-connected.
This looks like what is happening with sleep mode, in your case.

As I am not sure, and I am no Plasma user anymore, you might want to create a service to run the script, and see if it helps.

You can find such service templates/examples and instructions at Archwiki / Power management.
https://wiki.archlinux.org/title/Power_management#Sleep_hooks

4 Likes

Thank you @petsam this is most helpful! Glad that it's not only me facing this challenge.

Just a quick update.

I installed Linux Mint with Cinnamon to test how things will be and my dual monitor setup is doing exactly the same.

When the computer goes to sleep and comes back from it, everything is messed up again...

Pages and apps opened on screen 2 are on screen 1... actually, everything is on screen 1.

So I don't think this is a KDE Plasma problem but something global with Linux or it might be something with my video card not sure but I did install Garuda Linux on my laptop(NVIDIA RTX 2060) and when plugged into a completely different 3rd monitor(different than my desktop setup), the same result can be observed.

This most likely means that it's not a KDE Plasma issue and it's not a video card issue. (My main PC card is Radeon 5600 XT), but most likely some issue with the Linux kernel? Or I don't know but unless this is fixed Linux is unusable for me from a productivity point.

Any ideas are appreciated.

Thank you

Check your BIOS settings for a sleep mode, like S3 or similar, and alter/test other options. It could be that your vendor's default sleep setting disables external monitors completely.

Also consider disabling the Xsetup script in some of your tests, in case it has something wrong.

Frequently, using a different kernel can give different results with sleep functionality.

If it is possible, try hibernation, instead of sleep/suspend, to see if it works.

:person_shrugging:

1 Like

Hi @petsam

I've just realised that I was saying "when the monitor goes to sleep" when it actually goes to energy-saving mode.

I just tested by switching off the energy-saving mode and leaving only sleep and everything works fine.

So the problem is something to do with the energy-saving mode...

Any suggestions to overcome this?

Thank you
Kiril

1 Like

I have a dual-monitor setup that this happens to in KDE similar to how you describe, but in my case the two monitors awake from energy-saving mode at two quite obviously different speeds; the monitor that "wakes up" first is momentarily recognized as the only monitor and all open programs are (correctly) shifted to that workspace. The second monitor wakes up a moment later and starts off with an empty display.

I've never looked into it too much because it has never bothered me, but I guess if you want to use the energy-saving mode and preserve your display configuration, maybe you should investigate how to get both monitors to return from energy-saving at the same time.

1 Like

I suppose those functions have similar tasks. Power saving. Use any combination works better to your requirements/needs. :person_shrugging:

1 Like

@BluishHumility cable makes any difference. 1st is using DP and the second is HDMI.

Thank you guys for your help. I will remove the energy-saving mode and use the sleep function only as this works for now.

1 Like