Much ado about scripting, Linux & Eclipse: card subject to change


HOWTO: Make KDE remember dual-monitor randr settings

Every time I boot up, KDE appears to forget that I want my monitors to be positioned left-to-right and instead defaults to mirrored config. But, after a lot of cursing and a little googling, I found an answer so it'll no so much keep your settings, but reset its broken config to your settings.

1. Hit ALT-F2, then enter "display" to run the Display Settings app.

2. Configure your settings as you'd like. Note that if the Apply button isn't active after your changes, you can change/revert something like a Position: button to make it active.

3. On restart, KDE may forget your dual-monitor settings. So, to prevent this, go look in your ~/.kde/share/config/krandrrc file:

StartupCommands=xrandr --output "DVI-I-1" --pos 1920x0 --mode 1920x1200 --refresh 59.9502\nxrandr --output "HDMI-1" --pos 0x130 --mode 1920x1080 --refresh 60\nxrandr --noprimary

4. Copy the configuration into a new file, and replace \n with newlines. I like to put scripts like this in /etc/X11 because they relate to screen res and positioning.

# from ~/.kde/share/config/krandrrc
xrandr --output "DVI-I-1" --pos 1920x0 --mode 1920x1200 --refresh 59.9502 
xrandr --output "HDMI-1" --pos 0x130 --mode 1920x1080 --refresh 60 
xrandr --noprimary

5. Ensure the script is readable/executable for all users:

chmod 755 /etc/X11/

6. Hit ALT-F2, then enter "autostart" to run the Autostart config tool.

7. Click Add script... and browse for the script you created above.

8. Reboot and watch the magic unfold.


Dragon said...

Thanks for that, although I seemed to run into KDE bug #260360 after using this, I found Appending

killall plasma-desktop
sleep 2
plasma-desktop &

to the end of the script seems to fix it for me otherwise I get stuck just being able to see just the desktop background.

.peter said...

If somebody wants to detect if the desired output is connected and then to take action, use following script:

outputconnected=$(xrandr -q | grep "$1 disconnected" > /dev/null ; echo $?)

if [ $outputconnected != '0' ] ; then
echo "Do your xrandr command here."

Usage example: HDMI2


jed-halborn said...

Found this in "Hello,

Have you noticed the "Save a default" button underneath the "identify the screens" button? (labels may differer because i don't have englisch as default)

Does it work if you save the values this way?

I had the same problem until i noticed this (new?) button.

Sincerely Markus". Works fine for me on Fedora17 KDE 4.8.4

David PĂ©rez said...

Thanks for sharing this valuable trick! :-)

Giorgos said...

What about the "Save as default" option at the bottom of the window?

Giorgos said...

What about the "Save as default" option at the bottom of the window?

Jobs-It -India said...

HDMI, DisplayPort and DVI are all digital standards used for High Definition video signals. DVI & DisplayPort (V1) solely carry the video-image signal but no audio, where as HDMI covers each. Therefore if you employ a DVI or DisplayPort (V1) cable, you'll need to connect audio cables from your DVD-player, CPU, games console or cable/satellite receiver to your TV.