Set Permanent Resolution in Ubuntu (or Lubuntu) With LXDE

March 2nd, 2012 | By: | Tips, tricks & fixes (juicy bits!) | No comments »
LXDE Lightweight Desktop Environment

LXDE Lightweight Desktop Environment

Setting a permanent resolution seems quite straightforward in Ubuntu, sometimes! You may have had a few problems setting the resolution in Ubuntu 11.10 (among other things – which has led many people to seek out new distributions).

I decided to try out a few distributions (Crunchbang #!, Lubuntu, Mint to name a few) but also tried to tailor Ubuntu needs – which led me to LXDE.

LXDE

LXDE is a great lightweight desktop environment compared to Gnome or Ubuntu’s Unity. There are a few quibbles which I may address in the future, but the first one that struck me was my resolution not saving after changing it through the ‘preferences->Multiple Screens’ menu.

LXDE uses a gui (called GrandR) for XrandR to set the resolution, which works fine until you reboot to find yourself at square 1!

XrandR/GrandR does not make permanent changes

XrandR, with or without GrandR, save the changes you make to your display set up. It simply applies some changes you make with the command.

Using this command is not the problem, the problem is running the command every time you login! To get around this we need to run it automatically at startup.

Without further ado…. the fix

Lets open up a terminal, press…

Ctrl+Alt+t

Now I’m guess if you are using LXDE your default text editor is now Leafpad, so type/copy this…

sudo leafpad /etc/xdg/lxsession/LXDE/autostart

(if you use a different text editor change “leafpad” to whatever that may be)

You may be asked for a password as this file is saved as root, enter it and lets move on!

We need to enter find the correct XrandR command, you can find some help in this previous post, or by typing “man xrandr” to read the documentation.

Here is a sample command…

xrandr --auto --output DVI-1 --primary --mode 1680x1050 --left-of DVI-0

This command does the following

  •  -auto : enables connected devices in their preferred mode
  •  -output DVI-1 : selects the output device to modify
  •  -primary : specifies the selected device as primary
  •  -mode : sets a specific mode for the output device
  • -left-of DVI-0 : sets position of the devide to “left of” another device (DVI-0)

This command can be added to the end of your opened autostart file, remember to add a @ before the command. Here is my autostart file….

@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

 

Now reboot and your resolution should be saved!

Any problems drop us a comment and we’ll try help out.