Laptop with external display

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Linux n00b

Laptop with external display

Post by Linux n00b »

I cannot seem to get external display setup right.

I now connect my laptop to external monitor. What I want is very simple, I just want how Windows handle this situation - when external monitor is used, it switches off the monitor on laptop, and use the external monitor instead. And I can easily switch between them with the hot key on laptop. The laptop is windows/Mint dual boot (some things are best under windows, some are best under Linux). The windows boot works "perfectly" (well, apart from those thing windows are terrible at)

I'm running Mint 6 (no plan to "upgrade" unless it is broken). I can get twin view (nVidia graphics) to clone each monitor, but it is pain as the laptop has native resolution of 1440x900 and the external LCD has native resolution of 1280x1024. The clone sort of works (it seems to set each as 1440x1024, and scroll to "extra" area), even it is a little annoying. Any idea what I can do to make it work the way I wanted?

Edit: okay, after some search, found this, but I have no idea what it means. Do I just create this script file, then chmod +x, then make it run at startup? I have been having problem with startup script, eg. I asked my system to run conky, but it doesn't work. In particular, I don't understand any of those commend and what it will do.

Code: Select all

#! /bin/sh

if xrandr -q |grep -q "VGA-0 connected" ; then
xrandr --output VGA-0 --auto
xrandr --output LVDS --off
fi


Then I just run this script as a start-up app in Gnome
Just did a couple of test, this script does nothing on my laptop.
Husse

Re: Laptop with external display

Post by Husse »

Code: Select all

    #! /bin/sh

    if xrandr -q | grep -q "VGA-0 connected" ; then
    xrandr --output VGA-0 --auto
    xrandr --output LVDS --off
    fi
This little script looks for an indication that something (a monitor :)) is connected to vga0 and opens it and after that shuts down the internal monitor
Add this in a file and make the file executable - either in the GUI or with chmod, lets say you call the script conn

Code: Select all

chmod conn +x
As long as you are in home no sudo is needed
Save the file somewhere and set it as a start up file in Startup Applications
First test if you have VGA-0 by running

Code: Select all

xrandr -q | grep -i VGA
Now you should see which outputs you have - if that returns nothing you may have a DVI connection - check

Code: Select all

xrandr -q | grep -i DVI
From either of these two commands you should find out what the connector for your external monitor is called
Use that instead of VGA-0 if it's different
Test the script by running it manually before you add it to the startup apps
Linux n00b

Re: Laptop with external display

Post by Linux n00b »

That was strange, neither returns anything. That explains why that script does nothing, but what my monitor is running on? I'm certainly looking at it, and it works.
Husse

Re: Laptop with external display

Post by Husse »

??
Try just xrandr - it should give you a "description" of your video
Linux n00b

Re: Laptop with external display

Post by Linux n00b »

Here is what has returned.

Code: Select all

Screen 0: minimum 320 x 240, current 1440 x 1024, maximum 1440 x 1024
default connected 1440x1024+0+0 0mm x 0mm
   1440x900       50.0     73.0  
   1360x768       51.0     52.0  
   1152x864       53.0  
   1024x768       54.0  
   960x600        55.0  
   960x540        56.0  
   840x525        57.0     58.0  
   800x600        59.0     60.0  
   800x512        61.0  
   720x450        62.0  
   700x525        63.0  
   680x384        64.0     65.0  
   640x512        66.0  
   640x480        67.0     68.0  
   576x432        69.0  
   512x384        70.0  
   400x300        71.0  
   320x240        72.0  
   1440x1024      73.0* 
Husse

Re: Laptop with external display

Post by Husse »

???
The second line
default connected
should really have been either VGA connected or DVI connected
Default?
Oh well, I have to add this ot my list of unsolved mysteries :)
Linux n00b

Re: Laptop with external display

Post by Linux n00b »

Do you think it could be something to do with the internal display? Laptop does not connect through normal D-sub or DVI to its internal display, even the interface is just DVI I believe.

here is my lspci

Code: Select all

00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 0c)
00:01.0 PCI bridge: Intel Corporation Mobile PM965/GM965/GL960 PCI Express Root Port (rev 0c)
00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)
00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 4 (rev 03)
00:1c.4 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 5 (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)
00:1f.0 ISA bridge: Intel Corporation 82801HEM (ICH8M) LPC Interface Controller (rev 03)
00:1f.1 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03)
01:00.0 VGA compatible controller: nVidia Corporation GeForce 8400M GS (rev a1)
06:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN [Kedron] Network Connection (rev 61)
07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
08:05.0 FireWire (IEEE 1394): O2 Micro, Inc. Firewire (IEEE 1394) (rev 02)
08:05.2 SD Host controller: O2 Micro, Inc. Integrated MMC/SD Controller (rev 02)
08:05.3 Mass storage controller: O2 Micro, Inc. Integrated MS/xD Controller (rev 01)
Is there other command that will show how monitor system is connected to? I did try dmesg and lshw, but nothing seems returned about that part.
Husse

Re: Laptop with external display

Post by Husse »

I should have written this in my previous post
Maybe use default instead
First line like this

Code: Select all

if xrandr -q | grep -q "default connected" ; then
Thinking about it a bit more - was the externatl monitor connected when you run xrandr without a switch?
There is only one screen.....
Linux n00b

Re: Laptop with external display

Post by Linux n00b »

Husse wrote: Thinking about it a bit more - was the externatl monitor connected when you run xrandr without a switch?
There is only one screen.....
Yes connected, and one screen was I intended, it was setup in BIOS that if external monitor is connected, use external monitor. Some how, Mint just keeps getting back to the laptop display. One other interesting thing I think I forget to tell, but now I think it could be important. During the boot, selection screen and the mint slash screen are on the external monitor, but as soon as it passed to login screen, external monitor will be turned off.

I then have to hit the display switch hotkey, that will turn external monitor on, but laptop display stays on.

what Mint says about each monitor

CRT-0 is the external monitor, DFP-0 is the laptop display.
Husse

Re: Laptop with external display

Post by Husse »

Then try

Code: Select all

        #! /bin/sh

        if xrandr -q | grep -q "CRT-0 connected" ; then
        xrandr --output CRT-0 --auto
        xrandr --output DFP-0 --off
        fi
I don't know if that works given what I've seen from xrandr but it's worth a try
Linux n00b

Re: Laptop with external display

Post by Linux n00b »

Already tried, it does nothing. This is strange indeed. I will play around and try different thing later.

Edit: stand a correction - there is no BIOS option for monitor setting now, I sort of remember in the earlier days I had my laptop (before couple of BIOS update), there was a setting to set primary display. I remember my setting was auto (depending on external display connection detected).

It works as I expected always if I boot into windows partition (also no problem to enable laptop display to get dual monitor setting). The fact that Mint flash screen correctly use external monitor, lead me to believe the issue is pure software. There must be somewhere in Linux setting that remembers always stick to laptop display when x window is loaded.
Husse

Re: Laptop with external display

Post by Husse »

Check settings in GDM - I have Mint 6 on another partition on this computer but I suppose it's the same as in Gloria
What about if you choose "Failsafe Gnome"?
Linux n00b

Re: Laptop with external display

Post by Linux n00b »

Sorry to sound like complete noob, but how? Is there a central GDM I can check?

There is nVidia X server settings, where I can setup pretty much everything.

There is also screen resolution under preference which doesn't do much.

I don't see where is GDM central control.
mintnoob

Re: Laptop with external display

Post by mintnoob »

Have you tried using "grandr"? That's what I'm using on my laptop to us my TV as a monitor.
Linux n00b

Re: Laptop with external display

Post by Linux n00b »

the issue is not I cannot use the external monitor, or I cannot turn off the laptop display.

The issue is I cannot get the process automate.
Husse

Re: Laptop with external display

Post by Husse »

I'll dive into this soon time permitting - I have to work as well....
Linux n00b

Re: Laptop with external display

Post by Linux n00b »

No worry mate. It is not a big issue.

I think there must be a way to automate the process. It takes really only 1 hot-key and few mouse click each time boot up. Turning off the laptop display is only couple of mouse click away on the top.
Husse

Re: Laptop with external display

Post by Husse »

Thanks - I've got my hands full with things that can't wait now, have to skip most of Mint things atm
hidrauliChicken

Re: Laptop with external display

Post by hidrauliChicken »

Hey,

I did some research, and created this script, put it in /etc/init.d/ and ran update-rc.d on it.
I can start, and stop it, and adjusts the displays accordingly. Here's the problem, after the end of the sleep the system lags a bit, I discovered it by moving the mouse, it lagged while moving.
It's a minor thing, but you know how it is after discovering you can't ignore it.
Any idea to somehow correct this little glitch?

Code: Select all

#! /bin/bash

### BEGIN INIT INFO
# Provides:          monitorLayout.sh
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

DISPLAY=:0.0
export DISPLAY
LOGDEST=/home/*/monitorLayout.log
PIDFILE=""
DAEMON=""
NAME=""

do_start()
{
NAME=my-daemon
date --rfc-3339='seconds' 2>&1 | awk '{print $0, "starting monitorLayout"; fflush()}'  | tee -a $LOGDEST
while true
do
	string=$(xrandr | grep VGA)
	string2=$(xrandr | grep LVDS1)
	if [[ $string == *"1 connected"* && $string != *1680x1050+0+0* ]]; then
		xrandr --output LVDS1 --mode 1280x800 --pos 1680x0 --rotate normal --output TV1 --off --output VGA1 --mode 1680x1050 --pos 0x0 --rotate normal
		date --rfc-3339='seconds' 2>&1 | awk '{print $0, "Monitor connected, sending signal"; fflush()}'  | tee -a $LOGDEST

	elif [[ $string == *disconnected* && $string2 == *1280x800+1680+0* ]]; then
		xrandr --output LVDS1 --mode 1280x800 --pos 0x0 --rotate normal --output TV1 --off --output VGA1 --off
		date --rfc-3339='seconds' 2>&1 | awk '{print $0, "Monitor not connected, Laptop screen is the default"; fflush()}'  | tee -a $LOGDEST	
	fi
	sleep 5
done
}

do_stop()
{
	date --rfc-3339='seconds' 2>&1 | awk '{print $0, "stoping monitorLayout"; fflush()}'  | tee -a $LOGDEST
	pkill S90monitor
}

case "$1" in
start) 
	do_start
;;

stop) 
	do_stop
;;

force-reload|reload)
	exit 3
;;

restart)
	$0 stop && $0 start
;;

status)
	status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
;;

esac
:
GregDavidson

Re: Laptop with external display

Post by GregDavidson »

Here's the script that worked for me, don't forget to "chmod +x PATH"
(I called it xrandr-toggle and put it in ~/bin). Script starts on next line:
#!/bin/sh

# Optional comment block showing how I came up with this script:
# $ xrandr --prop | grep 'connected primary'
# eDP-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 382mm x 214mm
# $ xrandr --output eDP-1 --off
# $ xrandr -q | grep eDP-1
# eDP-1 connected primary (normal left inverted right x axis y axis)
# $ xrandr --output eDP-1 --auto
# $ xrandr -q | grep eDP-1
# eDP-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 382mm x 214mm

xrandr --prop | grep 'connected primary' | {
read dev a b res rest
# echo "$dev" "$res" "$rest"
case "$res" in
[0-9]*) xrandr --output "$dev" --off ;;
*) xrandr --output "$dev" --auto ;;
esac
# xrandr --prop | grep 'connected primary'
}
Last edited by Pierre on Tue Oct 16, 2018 10:53 pm, edited 1 time in total.
Reason: it is suggested that you start a New Post, rather than acivate an Older Post, as you do get more Help.
Locked

Return to “Beginner Questions”