up vote 8 down vote favorite
3
share [g+] share [fb]

I used to edit the startup script for the GDM (/etc/gdm/Init/Default) for to change permanently my display resolution . But how can I do this with the LigthDM in Ubuntu Oneiric? Thanks.

link|improve this question

75% accept rate
add to .xprofile in your home folder. See askubuntu.com/questions/63863/… for a basic guide to setting resolution and adding to .xprofile – duffydack Oct 19 '11 at 22:25
feedback

5 Answers

up vote 1 down vote accepted

I think you can add the display modes to /etc/X11/xorg.conf.

If you don't have a xorg.conf, then you can use the following as a basis. You need to replace the entries with the names Modeline, Driver and Modes with the correct entries for your system. Depending on your hardware, you may need additional entries, for example if your system has more than one graphic chip.

Section "Monitor"
    Identifier    "Monitor0"
    Modeline "1280x1024_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync
    Modeline "1024x768_60.00"   63.50  1024 1072 1176 1328  768 771 775 798 -hsync +vsync
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Card0"
    Monitor        "Monitor0"
    SubSection "Display"
        Modes       "1280x1024_60.00" "1024x768_60.00"
    EndSubSection
EndSection

Section "Device"
    Identifier    "Card0"
    Driver        "nvidia"
EndSection

If you don't know the name of the video driver that your system is using then you may get the name as follows (if you have an intel graphic chip, the driver name is just "intel"):

lshw -class display | grep "driver"

The modelines can be generated with cvt:

cvt <h-resolution> <v-resolution> [refresh]
link|improve this answer
I tried this and it wouldn't boot for some reason. I used the modeline generated from the cvt command and the driver from the other one (and tried vesa too), but it just hung with no error messages. Jon Roberts' solution worked perfectly for me and is independent of things such as the video card driver that you mention here which could easily go wrong for newbies, so therefore I'm voting his answer up. – Mike Nov 19 '11 at 23:49
feedback

Modify /etc/lightdm/lightdm.conf to add the following options:

display-setup-script > calls your mycustomloginvideo.sh before the login screen appears

session-setup-script > calls your mycustomdesktopvideo.sh before the user desktop session starts

[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
# for your login screen, e.g. LightDM (Ubuntu 11.10) or GDM (11.04 or earlier)
display-setup-script=/usr/share/mycustomloginvideo.sh
# for your desktop session
session-setup-script=/usr/share/mycustomdesktopvideo.sh

You may have "arandr" gui tool generate the above sh script, picking parameters from your current session's X configuration.

Make sure that your shell script is executable:

chmod a+x /usr/share/mycustom*video.sh

and you can test that it works (i.e. that you don't have any typos or configuration errors in your xrandr command) just by running it in a terminal:

/usr/share/mycustomdesktopvideo.sh

If the login script doesn't work for any reason, your machine might not complete the boot process to the login screen. If the desktop script fails, you might not get a desktop after logging in.

Cheers!

link|improve this answer
feedback

I have been trying to solve a similar problem for a while now and found a solution that works for me so hopefully it will help...

I have an old aspire one AOA110 that I have broken the screen on too many times and after buying a new laptop decided that I would try to turn it into a HTPC but the external display I have is not recognised by X so I have had to 'tweak' it numerous times to get it working at the correct resolution.

Here is what I did:

After using this http://ubuntuforums.org/showthread.php?t=1112186 tutorial up to step 5 I was able to find a working and acceptable resolution in xrandr but this wasn't working on the LightDM login screen.

Don't follow the steps to make it persistent in the above how to it may work but I think this is the proper way to do it in 11.10. I found this post on the ArchWiki https://wiki.archlinux.org/index.php/Xorg which I adapted to my needs.

First create a file here: /etc/X11/xorg.conf.d/10-monitor.conf

Then add the appropriate X details for your display here is how mine looked:

Section "ServerLayout"
Identifier     "DualSreen"
Screen       0 "Screen0"
Screen       1 "Screen1" RightOf "Screen0" #Screen1 at the right of Screen0
#Option         "Xinerama" "1" #To move windows between screens
EndSection

Section "Monitor"
Identifier     "LVDS1"
Option         "ignore" "true"
EndSection

Section "Monitor"
Identifier     "VGA1"
Option         "Enable" "true"
Modeline "1440x900_60.00"  106.47  1440 1520 1672 1904  900 901 904 932  -HSync +Vsync
EndSection

Section "Device"
Identifier     "Device0"
Driver         "intel"
Screen         0
EndSection

Section "Device"
Identifier     "Device1"
Driver         "intel"
Screen         1
EndSection

Section "Screen"
Identifier     "Screen0"
Device         "Device0"
Monitor        "VGA1"
DefaultDepth    24
Option         "TwinView" "0"
SubSection "Display"
    Depth          24
    Modes          "1440x900_60.00"
EndSubSection
EndSection

Section "Screen"
Identifier     "Screen1"
Device         "Device1"
Monitor        "LVDS1"
DefaultDepth   24
Option         "TwinView" "0"
SubSection "Display"
    Depth          24
EndSubSection
EndSection

The important bits to add are under the appropriate Section "Monitor" include the appropriate Modeline that you found while using gtf 1440 900 60.00 and then under the corresponding Section "Screen" including the correct Modes.

You'll notice that what I was trying to do was not only to set the VGA1 connection to a suitable resolution but also tell it not to use my LVDS1 output. Obviously you will need to tweak yours appropriately to match the right number of outputs and the right Device, Screen and Display sections for your setup.

Sorry for the epic post, I have been tweaking xorg.conf files for some time now with the Hannspree display I've been using and the old xorg.conf setups that I used pre 11.10 just don't work properly any more this is the only solution I've found that works.

Good Luck!

link|improve this answer
Using xrandr -q should give you the right info on which display is being used and possible Modes. – faithinfriction Dec 7 '11 at 17:05
feedback

Some one posted another workaround although I must say It didn't work for me probably could work for you, in my case it breaks down unity, can only move my mouse cursor around and the app indicator top panel looks empty, but after unplugging my LCD I was able to delete the added lines and everything went back to normal.

edit the file /usr/sbin/lightdm-session

Here is how the first part of that file looks now:

#!/bin/sh
#
# LightDM wrapper to run around X sessions.

echo “Running X session wrapper”

# Load profile
for file in “/etc/profile” “$HOME/.profile” “/etc/xprofile” “$HOME/.xprofile”; do
if [ -f "$file" ]; then
echo “Loading profile from $file”;
. “$file”
fi
done

xrandr --newmode “1368x768_60.00″ 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
xrandr --addmode CRT1 1368x768_60.00
xrandr --output CRT1 --mode 1368x768_60.00

# Load resources

Take note that the Xrandr settings should be changed to match yours.

link|improve this answer
feedback

I've created this script to make it more dynamically (multiple workspaces / different monitors).

Only annoyance: when you log in from lightdm, the screen still flashes like it wants to change resolution :s

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.