SSDM & Multiple Monitors - What am I doing wrong?! :'(

Hi all!

First time posting on this forum, I started using Linux back in the early 2010’s but I’ve been off and on with it - thankfully this forum is here to assist me with learning about Linux & pointing me in the right direction when I’m completely out of my depth (which, is most of the time)

I get the feeling that this topic has already been addressed here but I have not been successful with any of that threads suggestions. For context, I am attempting to only have 1 out of my 4 screens enabled when I go to lock my computer. Inside my /usr/share/sddm/scripts/Xsetup file I have added:

xrandr --output HDMI-0 --off
xrandr --output DP-1 --off
xrandr --output DP-5 --off

From my basic understanding of SDDM I am thinking this should work - unless I’m missing something? Any advice/assistance would be much appreciated!

EDIT: I forgot to give the usual rundown of my setup

Tumbleweed (updated to the bleeding edge whenever available)
KDE 6
Wayland is my display manager

Thanks! :slight_smile:

I believe what you want may not be possible via xrandr, for two reasons:

1-If I understand correctly, xrandr is an X11 tool that has reduced or no capability WRT Wayland.

2-Also IIRC, xrandr is only able to impact a session started from a DM, not the DM itself.

With any luck on your behalf, I’m wrong on both counts.

As you saw in that 2018 thread, in openSUSE, when I want xrandr to impact a session on startup, I put it in a file in /etc/X11/xinit/xinitrc.d/. I’ve never pursued manipulating any DM’s I/O (greeter) placement from without its own config file(s). When using KDM or TDM, I dictate which display hosts greeter placement using [k,t]dmrc’s GreeterScreen=.

Thanks for the reply!

I’m confused, doesn’t SDDM manage the login process? Or am I missing something?

It is completely unrelated to SDDM. Locking is handled by Plasma itself, not by display manager.

Thanks for the heads up - I’ll have a bit more of a squirrel around and see what I can find!

It used to be possible to run a script upon screen lock/unlock events, but since Plasma 6 the ability was removed…
https://www.reddit.com/r/kde/comments/17woevw/did_plasma_6_remove_running_scripts_on/
Here’s the bug report…
https://bugs.kde.org/show_bug.cgi?id=481069

I was trawling through the System Settings, Documentation,Reddit & so many other places! Thanks for assisting me in finding an answer! :slight_smile:

BTW, user management of displays in KDE Plasma can be done via the kscreen-doctor CLI.

More info

kscreen-doctor --help

Thanks for your response!

I attempted to write a bash script that does it using kscreen-doctor and it’s not working, would you be able to assist if possible?

#!/bin/bash

while true; do
# Capture key events and filter for Windows+L combination
xev -event keyboard | grep -E “KeyPress.*Super_L.*l” >/dev/null 2>&1

# If the combination is detected, disable desired outputs
if [ $? -eq 0 ]; then
    xdotool search --onlyvisible --class 'Kscreen-Doctor' output.DP-1.disable output.DP-5.disable output.>
fi

# Sleep to avoid high CPU usage
sleep 1

done

I’ve then got a similar script for when I log back in to enable those screens again - which is this.

#!/bin/bash

while true; do
# Capture key events and filter for Super+Shift+L combination
xev -event keyboard | grep -E “KeyPress.*Super_L.*Shift_L.*l” >/dev/null 2>&1

# If the combination is detected, enable desired outputs
if [ $? -eq 0 ]; then
    xdotool search --onlyvisible --class 'Kscreen-Doctor' output.DP-1.enable output.DP-5.enable output.HD>
fi

# Sleep to reduce CPU usage
sleep 1  # Adjust sleep interval as needed

done

Dunno what I’m doing wrong… Any tips?

Apologies for the formatting issues, please see below!

#!/bin/bash

while true; do
# Capture key events and filter for Windows+L combination
xev -event keyboard | grep -E “KeyPress.*Super_L.*l” >/dev/null 2>&1

# If the combination is detected, disable desired outputs
if [ $? -eq 0 ]; then
    xdotool search --onlyvisible --class 'Kscreen-Doctor' output.DP-1.disable output.DP-5.disable output.>
fi

# Sleep to avoid high CPU usage
sleep 1
done
#!/bin/bash

while true; do
# Capture key events and filter for Super+Shift+L combination
xev -event keyboard | grep -E “KeyPress.*Super_L.*Shift_L.*l” >/dev/null 2>&1

# If the combination is detected, enable desired outputs
if [ $? -eq 0 ]; then
    xdotool search --onlyvisible --class 'Kscreen-Doctor' output.DP-1.enable output.DP-5.enable output.HD>
fi

# Sleep to reduce CPU usage
sleep 1  # Adjust sleep interval as needed
done

Why don’t you call kscreen-doctor directly?

Example
https://www.reddit.com/r/kde/comments/o7p72v/kscreendoctor_bash_script_for_those_of_us_with_a/

This line is truncated.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.