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

Showing posts with label xrandr. Show all posts
Showing posts with label xrandr. Show all posts

2011-11-09

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:

[Display]
ApplyOnStartup=true
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/1920x2.sh

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.

2010-01-05

Switching monitors with xrandr

Sure, there are applets and other GUI tools to do this, but nothing beats the purity of going commando, er, commandline. :) Thanks to this article for the inspiration.

# reset 
xrandr --auto

# turn off laptop screen
xrandr --output LVDS --off

# 24" 16x12 on
xrandr --output VGA --mode 1600x1200

# reset 
xrandr --auto

# turn off external screen
xrandr --output VGA --off

# laptop screen on
xrandr --output LVDS --mode 1280x800

UPDATE, 2010/01/05:

To enable both screens and force the larger one to include the taskbar:

# reset 
xrandr --auto

# laptop screen on
xrandr --output LVDS1 --mode 1280x800 --noprimary --pos 1600x0

# 24" 16x12 on
xrandr --output VGA1 --mode 1600x1200 --primary --pos 0x0

# echo current status
xrandr --current