Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a tricky problem regarding multiple monitors on KDE (Kubuntu). I have a laptop which, at home, is connected to two monitors - VGA and HDMI. That works only when the built-in laptop display is disabled (at least I was told that).

The problem is that now I took the laptop away and booted it up with no external monitors connected. The system remembers that the built-in display was disabled, so it disables it even though it is the only monitor connected. Obviously, that makes the laptop pretty much unusable. Switching to a terminal through Ctrl+Alt+F# works, I can login; even Guest works normally.

The question is, how do I (re)set an account's monitor settings through terminals, since I can't use the GUI?

Thanks

share|improve this question
3  
Related question with a recent answer re xrandr that might be useful. –  user76204 Feb 25 '13 at 20:16
1  
This helped when I could use the console on the second monitor, xrandr was able to set my settings. However, when i can only use the non-gui terminal, xrandr says it can't open display, so it's pretty useless. –  Martin Melka Feb 27 '13 at 8:48
    
How did you disable the built-in laptop display? –  nutty about natty Feb 27 '13 at 18:00
    
I don't know if there's a relevant difference to KDE, but in standard ubuntu it works just fine for me (with the internal monitor switched off via the GUI, with the laptop lid closed and the laptop sitting comfortably in its docking station). –  nutty about natty Feb 27 '13 at 18:03
    
Are you using a docking station ? –  nutty about natty Feb 27 '13 at 18:03

3 Answers 3

up vote 2 down vote accepted
+100

Good question. A bit tricky to answer, but here is a try.

Basic Answer

There is actually a little reset possiblity included in X11. You can find it at /etc/X11/Xreset. You could use the Xreset directory (Xreset.d) to paste a script that runs automatically when a user logs out. The README file:

# Scripts in this directory are executed as root when a user log out from
# a display manager using /etc/X11/Xreset.
# The username of the user logging out is provided in the $USER environment
# variable.

You could thus a) add a reset script in /etc/X11/Xreset.d and b) make a script attached to a launcher that sets your dual external displays up. As such, you would log off and everything would be back to normal, you would log on to your laptop, hit the launcher for the displays and enjoy life.

More information

  1. You might want to look into sudo dpkg-reconfigure -phigh xserver-xorg for resetting the xserver or (probably better look at the answer Mik suggested in the comments).

  2. A SuSE guy wrote a nice article about X.

  3. In a solved bugreport someone states:

    admins can drop scripts in /etc/X11/Xreset.d/ to run after the user logs out.

  4. This is the contents of the file:

You can find it on your own system.

#!/bin/sh
#
# /etc/X11/Xreset
#
# global Xreset file -- for use by display managers

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

set -e

PROGNAME=Xreset
SYSSESSIONDIR=/etc/X11/Xreset.d

if [ ! -d "$SYSSESSIONDIR" ]; then
  # Nothing to do, exiting
  exit 0
fi

# 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:
share|improve this answer
    
Interesting. The reset script doesn't do anything though. I ran it through tty, restarted computer, but everything was the same. Same with putting it into the folder :| I tried putting xrandr commands inside too, but to no avail –  Martin Melka Mar 4 '13 at 20:12
    
The reset script runs whatever is found in the Xreset.d directory. –  don.joey Mar 5 '13 at 7:59
    
Right. It didn't work for me at first, because I forgot to add executable permission to the script. Now it works like a charm. Thank you. One small remark, however. If I put the laptop to sleep and unplug monitors during that, I have not logged off and so the screen will not be reset. Is there a way to logoff myself through tty? I tried logging in as the same user who uses X, but logoff only logged me off from the tty, not from X. –  Martin Melka Mar 5 '13 at 20:15
    
Hi Martin. I am happy you got it to work! Did you try something like gnome-session-quit? Source: askubuntu.com/questions/15795/… –  don.joey Mar 6 '13 at 6:50

One thing I haven't mentioned yet, but what might be critical: if you were using a Thinkpad laptop, the solution would be straightforward: Fn+F7. If you're using a different manufacturer's laptop, there will, in good likelihood, be some other Fn-type key which will toggle through the display/screen outputs (e.g., beamer, external monitor, internal display; mirror, on/off, and the like) down at the BIOS level (I'd assume).

So there'd be no need to reset anything within Linux, so to speak.

share|improve this answer
    
I have an IdeaPad, but the Fn+keys don't work (the only one that does is Sleep) –  Martin Melka Mar 3 '13 at 16:52
    
My hunch is: keep going with this one! I don't have time to thoroughly investigate myself presently, though there's a good chance I could do some optimization in this field on my IBM Thinkpad X41, but -for what it's worth- most Fn keys do work on my system (both on my laptop, as well as on my external sk-8855 "thinkvantage" keyboard): in ubuntu software center (or synaptic) at a first superficial glance at least this thing tp-smapi-dkms 0.41-1 is installed. So you may wanna try installing it, looking into it and/or similar alternatives which will make your Fn keys finally come to life! –  nutty about natty Mar 3 '13 at 17:41
    
also check out tpctl.sourceforge.net –  nutty about natty Mar 3 '13 at 17:48

have you tried (sth like)

DISPLAY=:0 xrandr --output LVDS1 --auto

from a different tty (e.g. tty1),

which you can access through Ctrl Alt F1 and switch back to (the standard graphical) tty7 with Ctrl Alt F7?

share|improve this answer
    
This is giving me xrandr: Configure crtc 1 failed when attempting --output HDMI1 --off . --auto doesn't say anything, until i manually switch it off. Then --auto throws the same error –  Martin Melka Mar 3 '13 at 17:00
    
would need to investigate more closely; am positive it would work, eventually... –  nutty about natty Mar 3 '13 at 17:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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