Set a specific screen resolution with xrandr
I was trying to change the default resolution of LXDE on Ubuntu (LXDE is also used in Lubuntu) and I found a solution for this problem. I also have Lubuntu installed and I've checked that this file actually exists which it does (Ijust tried this fix as well and it worked).
So, the fix....
- Open up a terminal, press ctrl+alt+t
-
I'm guessing you have a default Lubuntu install, so "Leafpad" would be your default editor, type/copy this into the terminal and press enter... (you may be asked for a password)
sudo leafpad /etc/xdg/lxsession/LXDE/autostart
-
Now add your commands to the bottom of the file adding a @ before the actual command. Mine looked like this after...
@xscreensaver -no-splash @lxpanel --profile LXDE @pcmanfm --desktop --profile LXDE @/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 @xrandr --auto --output DVI-1 --primary --mode 1680x1050 --left-of DVI-0
I personally put those sorts of commands, to be run at login, in a script in ~/bin
, call it set_resolution
Then run gnome-session-properties
and add the command to be run at login (use ~/bin/set_resolution).
Here's another line added to my /etc/xdg/lxsession/LXDE/autostart
file to get it working:
@xrandr --output LVDS --off
tip from: http://lists.freedesktop.org/archives/xorg/2007-August/027490.html
Update: the above was fine for awhile until I ran the GUI config tool lxrandr
, which seems stupidly unaware of dual-monitor setups. So I made this change:
$ cat $HOME/.config/autostart/lxrandr-autostart.desktop
[Desktop Entry]
Type=Application
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR --then manually tweaked
Exec=xrandr --output DVI-0 --mode 1920x1200 --rate 60.0 --output LVDS --off --output VGA-0 --primary --mode 1920x1200 --left-of DVI-0
OnlyShowIn=LXDE
Note that I'm running Ubuntu 12.04 with LXDE. One would hope that a pure Lubuntu 12.04 setup would include a smarter lxrandr
binary...