PDA

View Full Version : [ubuntu] 12.04 - External Monitor Default Resolution



daveosociologist
May 23rd, 2012, 07:22 PM
I have an external monitor (VGA) with a default resolution of 1920x1080. I can add the resolution mode using xrandr, getting the monitor to work. Unfortunately a restart kills the added mode. In previous versions of ubuntu I would follow these instructions:

http://www.ubuntugeek.com/how-change-display-resolution-settings-using-xrandr.html

What do I edit in 12.04 to keep this added resolution mode every startup?

papibe
May 24th, 2012, 06:37 AM
Hi daveosociologist.

You can add the modeline to the 'Monitor' section of your X configuration file (/etc/X11/xorg.conf).

For example:

Section "Monitor"
...
ModeLine “1024768″ 70.00 1024 1072 1176 1328 768 771 775 798 -hsync +vsync
EndSection
Then in the 'Screen' section you use that mode:

Section "Screen"
...
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1024768"
EndSubSection
EndSection
Hope it helps, and tell us how it goes.
Regards.

Source: Video Modes FAQ (http://www.x.org/wiki/FAQVideoModes).

daveosociologist
May 24th, 2012, 01:33 PM
Foiled again. Same problem I had with the other approach I linked in the top post.... there is no /etc/X11/xorg.conf, there is no /etc/lightdm/Init/Default.

Poking around in X11, I have /etc/X11/Xsession; options; Xwrapper.config; and default-display manager.

Since the default-display-manager file just has /usr/sbin/lightdm listed, it seemed like a reasonable place to look and there is a lightdm-session file listed there. Don't think this is the place though:


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

echo "Running X session wrapper"

message () {
# pretty-print messages of arbitrary length; use xmessage if it
# is available and $DISPLAY is set
MESSAGE="$PROGNAME: $*"
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
fi
}

errormsg () {
# exit script with error
message "$*"
exit 1
}

# 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

# Load resources
xresourcedir="/etc/X11/Xresources"
if [ -d "$xresourcedir" ]; then
for file in $xresourcedir/*; do
echo "Loading resource: $file"
xrdb -nocpp -merge "$file"
done
fi
xresourcefile="$HOME/.Xresources"
if [ -f "$xresourcefile" ]; then
echo "Loading resource: $xresourcefile"
xrdb -nocpp -merge "$xresourcefile"
fi

# Load keymaps
for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
if [ -f "$file" ]; then
echo "Loading keymap: $file"
setxkbmap `cat "$file"`
XKB_IN_USE=yes
fi
done

# Load xmodmap if not using XKB
if [ -z "$XKB_IN_USE" ]; then
for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
if [ -f "$file" ]; then
echo "Loading modmap: $file"
xmodmap "$file"
fi
done
fi

unset XKB_IN_USE

# Run all system xinitrc shell scripts.
xinitdir="/etc/X11/xinit/xinitrc.d"
if [ -d "$xinitdir" ]; then
for script in $xinitdir/*; do
echo "Loading xinit script $script"
if [ -x "$script" -a ! -d "$script" ]; then
. "$script"
fi
done
fi

# Load Xsession scripts
# OPTIONFILE, USERXSESSION, USERXSESSIONRC and ALTUSERXSESSION are required
# by the scripts to work
xsessionddir="/etc/X11/Xsession.d"
OPTIONFILE=/etc/X11/Xsession.options
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession

if [ -d "$xsessionddir" ]; then
for i in `ls $xsessionddir`; do
script="$xsessionddir/$i"
echo "Loading X session script $script"
if [ -r "$script" -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
. "$script"
fi
done
fi

echo "X session wrapper complete, running session $@"

exec $@So then, here is /etc/X11/XSession:


#!/bin/sh
#
# /etc/X11/Xsession
#
# global Xsession file -- used by display managers and xinit (startx)

# $Id: Xsession 967 2005-12-27 07:20:55Z dnusinow $

set -e

PROGNAME=Xsession

message () {
# pretty-print messages of arbitrary length; use xmessage if it
# is available and $DISPLAY is set
MESSAGE="$PROGNAME: $*"
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
fi
}

message_nonl () {
# pretty-print messages of arbitrary length (no trailing newline); use
# xmessage if it is available and $DISPLAY is set
MESSAGE="$PROGNAME: $*"
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2;
if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
fi
}

errormsg () {
# exit script with error
message "$*"
exit 1
}

internal_errormsg () {
# exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
# One big call to message() for the sake of xmessage; if we had two then
# the user would have dismissed the error we want reported before seeing the
# request to report it.
errormsg "$*" \
"Please report the installed version of the \"x11-common\"" \
"package and the complete text of this error message to" \
"<debian-x@lists.debian.org>."
}

# initialize variables for use by all session scripts

OPTIONFILE=/etc/X11/Xsession.options

SYSRESOURCES=/etc/X11/Xresources
USRRESOURCES=$HOME/.Xresources

SYSSESSIONDIR=/etc/X11/Xsession.d
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession
ERRFILE=$HOME/.xsession-errors

# attempt to create an error file; abort if we cannot
if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] &&
[ ! -L "$ERRFILE" ]; then
chmod 600 "$ERRFILE"
elif ERRFILE=$(tempfile 2> /dev/null); then
if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then
message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
"\"$ERRFILE\"; look for session log/errors in" \
"\"$TMPDIR/xsession-$USER\"."
fi
else
errormsg "unable to create X session log/error file; aborting."
fi

# truncate ERRFILE if it is too big to avoid disk usage DoS
if [ "`stat -c%s \"$ERRFILE\"`" -gt 500000 ]; then
T=`mktemp -p "$HOME"`
tail -c 500000 "$ERRFILE" > "$T" && mv -f "$T" "$ERRFILE" || rm -f "$T"
fi

exec >>"$ERRFILE" 2>&1

echo "$PROGNAME: X session started for $LOGNAME at $(date)"

# sanity check; is our session script directory present?
if [ ! -d "$SYSSESSIONDIR" ]; then
errormsg "no \"$SYSSESSIONDIR\" directory found; aborting."
fi

# Attempt to create a file of non-zero length in /tmp; a full filesystem can
# cause mysterious X session failures. We do not use touch, :, or test -w
# because they won't actually create a file with contents. We also let standard
# error from tempfile and echo go to the error file to aid the user in
# determining what went wrong.
WRITE_TEST=$(tempfile)
if ! echo "*" >>"$WRITE_TEST"; then
message "warning: unable to write to ${WRITE_TEST%/*}; X session may exit" \
"with an error"
fi
rm -f "$WRITE_TEST"

# use run-parts to source every file in the session directory; we source
# instead of executing so that the variables and functions defined above
# are available to the scripts, and so that they can pass variables to each
# other
SESSIONFILES=$(run-parts --list $SYSSESSIONDIR)
if [ -n "$SESSIONFILES" ]; then
set +e
for SESSIONFILE in $SESSIONFILES; do
. $SESSIONFILE
done
set -e
fi

exit 0

# vim:set ai et sts=2 sw=2 tw=80:Not sure what to do with this stuff. Previously there had been a monitor section so I don't really know what I am looking for in there. Any thoughts?

papibe
May 24th, 2012, 05:14 PM
.... there is no /etc/X11/xorg.conf

Let's create one.

It is best to create it with the proper graphic driver, but this should work to create a generic one:

sudo Xorg -configure
that will create a file named ~/xorg.conf.new. You have to move it then:

sudo mv ~/xorg.conf.new /etc/X11/xorg.conf
Then you can edit it as in my previous post:

gksudo gedit /etc/X11/xorg.conf
Then restart your machine.

Tell us how it goes.
Regards.

gsscoder
December 3rd, 2012, 04:01 PM
Hi,
I've the same problem...

I'm trying to connect a VAIO laptop with Ubuntu 12.04 to an external HP w20 monitor.

Anyway 'sudo XOrg -configure' allow configuration of current display not an external one. Am I wrong?

Regards,
Giacomo