Saving previous configuration when switching displays using Meta + P

Hi there, apologies if this is the wrong category to post this in. I am new to EndeavourOS and got it installed using the default bundled KDE + Kwin and wanted to explain a workflow process that I use at home.

I currently have two monitors, a middle one that I plug into my work laptop during the day and when I’m done work, I want the monitor to go back to my desktop running EndeavourOS with it being the primary monitor.

Before in Windows 11, I would use Windows + P to select “Second Screen Only” so that the monitor would automatically switch to my work laptop. This lets my second screen be the primary of my desktop, and then when I am done, I would select “Extend” and unplug the cable from my laptop - giving me 2 screens again for my desktop and the middle screen would automatically be set as my primary.

I was trialing a fresh install of EndeavourOS and tried the same workflow, things work just fine - however when I unplug the laptop and select “Extend Left” using Meta + P, the second monitor stays as the primary and I have to manually reselect the main monitor as the primary again.

I was wondering if there was a way to save monitor profiles or easily switch it without having to manually select the “Set as Primary” every single time. Thanks in advance!

Hi @jds17 and welcome to the forum!
Use
kscreen-doctor -o
to collect device names and Geometry data
I have 2 monitors and here are 2 draft scripts to set my HDMI monitor and its role (primary or not.)

#!/bin/bash
# to the left
kscreen-doctor output.HDMI-A-1.enable \
               output.eDP-1.priority.1 \
               output.eDP-1.mode.1 \
               output.HDMI-A-1.mode.9 \
               output.HDMI-A-1.position.0,0 \
               output.eDP-1.position.1600,0
#!/bin/bash
# to the right
kscreen-doctor output.HDMI-A-1.enable \
               output.HDMI-A-1.priority.1 \
               output.eDP-1.mode.1 \
               output.HDMI-A-1.mode.9 \
               output.HDMI-A-1.position.1920,0 \
               output.eDP-1.position.0,0

‘priority 1’ means primary and see kscreen-doctor -h
(chmod +x your script)

@eso Oh wow fantastic, this is exactly what I was looking for. Everything works flawlessly, thank you so much for your help!

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