LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   slackware, how to configure external monitor in laptop? (http://www.linuxquestions.org/questions/slackware-14/slackware-how-to-configure-external-monitor-in-laptop-830662/)

saavedra29 09-06-2010 05:12 PM

slackware, how to configure external monitor in laptop?
 
Hello everyone!
I have slackware 13.1 installed on my laptop and use kde.I just bought a new external monitor 1680 X 1050. The laptop's monitor is 1280 X 800. From KDE i configured laptop's screen to be inactive and the external monitor at resolution 1680 X 1050.
When i boot and enter KDE both monitors are activated, ican't understand their resolution. Then, just when i enter system configuration-monitor-monitor configuration the laptop's monitor automaticly turns off. Then i configure the external to 1680 X 1050 resolution. This happens every time i have to enter slackware.
Can you help me setup my xorg.conf file. You can see it below:
Code:

Section "ServerLayout"
        Identifier    "X.org Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
        ModulePath  "/usr/lib/xorg/modules"
        FontPath    "/usr/share/fonts/local"
        FontPath    "/usr/share/fonts/TTF"
        FontPath    "/usr/share/fonts/OTF"
        FontPath    "/usr/share/fonts/Type1"
        FontPath    "/usr/share/fonts/misc"
        FontPath    "/usr/share/fonts/CID"
        FontPath    "/usr/share/fonts/75dpi/:unscaled"
        FontPath    "/usr/share/fonts/100dpi/:unscaled"
        FontPath    "/usr/share/fonts/75dpi"
        FontPath    "/usr/share/fonts/100dpi"
        FontPath    "/usr/share/fonts/cyrillic"
EndSection

Section "Module"
        Load  "glx"
        Load  "dri2"
        Load  "dri"
        Load  "extmod"
        Load  "dbe"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/input/mice"                                                     
        Option      "ZAxisMapping" "4 5 6 7"                                                       
EndSection                                                                                         
                                                                                                   
Section "Monitor"                                                                                   
        Identifier  "Monitor0"                                                                     
        VendorName  "Monitor Vendor"                                                               
        ModelName    "Monitor Model"                                                               
EndSection                                                                                         
                                                                                                   
Section "Device"                                                                                   
        ### Available Driver options are:-                                                         
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",                               
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"                                           
        ### [arg]: arg optional                                                                     
        #Option    "NoAccel"                  # [<bool>]
        #Option    "SWcursor"                  # [<bool>]
        #Option    "ColorKey"                  # <i>
        #Option    "CacheLines"                # <i>
        #Option    "Dac6Bit"                  # [<bool>]
        #Option    "DRI"                      # [<bool>]
        #Option    "NoDDC"                    # [<bool>]
        #Option    "ShowCache"                # [<bool>]
        #Option    "XvMCSurfaces"              # <i>
        #Option    "PageFlip"                  # [<bool>]
        Identifier  "Card0"
        Driver      "intel"
        VendorName  "Unknown Vendor"
        BoardName  "Unknown Board"
        BusID      "PCI:0:2:0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device    "Card0"
        Monitor    "Monitor0"
        DefaultDepth 24
        SubSection "Display"
                Viewport  0 0
                Depth    1
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    4
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    8
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    15
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    16
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    24
        EndSubSection
EndSection

also my graphic's card is
Code:

00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controlle
r (rev 03) (prog-if 00 [VGA controller])

and xrandr -q command says:
Code:

slaris@aris29:~$ xrandr -q
Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 8192 x 8192
VGA1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 474mm x 296mm
  1680x1050      59.9*+  60.0 
  1280x1024      75.0    60.0 
  1440x900      75.0    59.9 
  1280x960      60.0 
  1152x864      75.0 
  1024x768      75.1    60.0 
  832x624        74.6 
  800x600        75.0    60.3    56.2 
  640x480        75.0    60.0 
  720x400        70.1 
LVDS1 connected (normal left inverted right x axis y axis)
  1280x800      60.0 +
  1024x768      60.0 
  800x600        60.3    56.2 
  640x480        59.9 
TV1 disconnected (normal left inverted right x axis y axis)

Do you have any idea how to fix it?

allend 09-06-2010 08:07 PM

Have you tried not having an xorg.conf file? i.e. Just rename your /etc/X11/xorg.conf file to something like /etc/X11/xorg.conf.old and restart X. The X autodetection should have no problem with your setup.

PS Welcome to LQ!

D1ver 09-07-2010 01:47 AM

If you have KDE installed, the 'system settings->display settings" GUI works flawlessly in my experiences. I'm often jumping between different screens on my netbook and it hasn't missed a beat.

saavedra29 09-07-2010 07:56 AM

i deleted the xorg.conf file (first i got a backup) and rebooted. It created almost the same file just adding a line (i can't remember it but nothing changed in the settings). Then i restored the old xorg.conf.
Allend i didn't try to rename the xorg.conf file but sisce i did what i mentioned above i guess it's the same thing. If i am wrong let me know and i will try it.
Diver i have KDE and when i change the settings every time i log in everything works ok. But the point is, if possible, not to change these settings every time i log in. I just thought if xorg.conf could do it automaticelly..

catkin 09-07-2010 12:24 PM

Here's the script I have configured on Slackware 13.1 to run on pressing Fn+F4, the hotkey to switch between internal and external screens on a Samsung N150 netbook. Some of it is hardware specific (VGA1 and LVDS1) and you may or may not want to use yad (or zenity ...) to display a message in the graphical desktop environment but hopefully it will give some useful clues. The first version was more complex but xrandr's --auto option did all I wanted and simplified the code. The shell setup commands are probably superfluous.
Code:

#! /bin/bash

# Set up shell
export PATH=/usr/local/bin:/usr/bin:/bin
set -o nounset
shopt -s extglob
unalias -a

# Get status
xrandr_q_out=$( xrandr -q )

# Check external screen connected
if [[ ! $xrandr_q_out =~ 'VGA1 connected' ]]; then
    /usr/bin/yad --button=gtk-quit --image=/usr/share/icons/Tango/22x22/status/error.png \
        --on-top --sticky --title=" ${0##*/} " \
        --text 'Error: external screen not connected' \
        --window-icon /usr/share/icons/Tango/22x22/status/error.png
    exit 1
fi

# Determine which screen to de/activate
internal_active=
external_active=
while read line
do
    [[ $line =~ ^VGA1.*mm$ ]] && external_active=true
    [[ $line =~ ^LVDS1.*mm$ ]] && internal_active=true
done <<< "$xrandr_q_out"
# If both active switch to external to suit most common usage pattern.
if [[ $internal_active ]]; then
    new_screen=VGA1
    old_screen=LVDS1
else
    new_screen=LVDS1
    old_screen=VGA1
fi

# Switch screens
xrandr --output $new_screen --auto && xrandr --output $old_screen --off

exit


igadoter 09-07-2010 12:45 PM

Hi,
the strange for me is that xrandr cannot determines default settings for your LVDS (laptop) display - they are matched by star '*'. Try to run any other desktop or window manger and setup layout with xrandr. Due to your information (I guess) the system starts in clone mode (both displays have the same contents) but this impossible as maximall resolution of your laptop display is too small. This (I guess) causes your laptop display turns off. Maybe this will help: 1) turn off your VGA display, 2) run X server, 3) run xrandr and blindly (without turning on) setup layout of your displays - resolutions, refresh rates, relative positions, 4) turn on VGA display. Finally check out man for intel card driver. Greetings.

w1k0 09-07-2010 01:44 PM

On my ThinkPads from T series I use the following script to switch between the screens:

Code:

#!/bin/bash
 
# External output may be "VGA" or "VGA-0" or "DVI-0" or "TMDS-1"
EXTERNAL_OUTPUT="VGA-0"
INTERNAL_OUTPUT="LVDS"
EXTERNAL_LOCATION="left"
 
# Figure out which user and X11 display to work on
# TODO there has to be a better way to do this?
X_USER=$(w -h -s | grep ":[0-9]\W" | head -1 | awk '{print $1}')
export DISPLAY=$(w -h -s | grep ":[0-9]\W" | head -1 | awk '{print $3}')

echo $X_USER $DISPLAY
 
# Switch to X user if necessary
if [ "$X_USER" != "$USER" ]; then
      SU="su $X_USER -c"
else
      SU="sh -c"
fi
 
case "$EXTERNAL_LOCATION" in
      left|LEFT)
              EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
              ;;
      right|RIGHT)
              EXTERNAL_LOCATION="--right-of $INTERNAL_OUTPUT"
              ;;
      top|TOP|above|ABOVE)
              EXTERNAL_LOCATION="--above $INTERNAL_OUTPUT"
              ;;
      bottom|BOTTOM|below|BELOW)
              EXTERNAL_LOCATION="--below $INTERNAL_OUTPUT"
              ;;
      *)
              EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
              ;;
esac
 
# Figure out current state
# INTERNAL_STATE=$($SU xrandr | grep ^$INTERNAL_OUTPUT | grep " con" | sed "s/.*connected//" | sed "s/ //" | sed "s/ .*//g")
# EXTERNAL_STATE=$($SU xrandr | grep ^$EXTERNAL_OUTPUT | grep " con" | sed "s/.*connected//" | sed "s/ //" | sed "s/ .*//g")

# I recommend to replace these prior two statements, since otherwise with  xrandr 1.2 it produces wrong results:
# a textportion "(normal" otherwise still remains when a screen is connected, but switched off (by e.g. toggling!)
# (comment out the prior two lines, and uncomment the following two lines:)
INTERNAL_STATE=$($SU xrandr | grep ^$INTERNAL_OUTPUT | grep " con" | sed "s/.*connected//" | sed "s/ //" | sed "s/ .*//g"| sed "s/(normal//g" )
EXTERNAL_STATE=$($SU xrandr | grep ^$EXTERNAL_OUTPUT | grep " con" | sed "s/.*connected//" | sed "s/ //" | sed "s/ .*//g"| sed "s/(normal//g" )
 
 
if [ -z "$INTERNAL_STATE" ]; then
      STATE="external"
elif [ -z "$EXTERNAL_STATE" ]; then
      STATE="internal"
else
      INTERNAL_STATE=$(echo $INTERNAL_STATE | sed "s/[0-9]*x[0-9]*//")
      EXTERNAL_STATE=$(echo $EXTERNAL_STATE | sed "s/[0-9]*x[0-9]*//")
      if [ "$INTERNAL_STATE" = "$EXTERNAL_STATE" ]; then
              STATE="mirror"
      else
              STATE="both"
      fi
fi
 
function screen_external(){
# recommend exchange the order, since otherwise doesn't work
# with my ati adapter (please uncomment if needed, and
#comment out the other two):
      $SU "DISPLAY=$DISPLAY xrandr --output $EXTERNAL_OUTPUT --auto"
      $SU "DISPLAY=$DISPLAY xrandr --output $INTERNAL_OUTPUT --off"
#      $SU "DISPLAY=$DISPLAY xrandr --output $INTERNAL_OUTPUT --off"
#      $SU "DISPLAY=$DISPLAY xrandr --output $EXTERNAL_OUTPUT --auto"
echo "*** ext"
}
 
function screen_internal(){
      $SU "DISPLAY=$DISPLAY xrandr --output $EXTERNAL_OUTPUT --off"
      $SU "DISPLAY=$DISPLAY xrandr --output $INTERNAL_OUTPUT --auto"
echo "*** int"
}
 
function screen_mirror(){
      $SU "DISPLAY=$DISPLAY xrandr --output $INTERNAL_OUTPUT --auto"
      $SU "DISPLAY=$DISPLAY xrandr --output $EXTERNAL_OUTPUT --auto --same-as $INTERNAL_OUTPUT"
echo "*** mir"
}
 
function screen_both(){
      $SU "DISPLAY=$DISPLAY xrandr --output $INTERNAL_OUTPUT --auto"
      $SU "DISPLAY=$DISPLAY xrandr --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION"
echo "*** bot"
}
 
function screen_toggle(){
      case "$STATE" in
              internal)
                      screen_mirror
                      ;;
              mirror)
                      screen_external
                      ;;
              external)
                      screen_both
                      ;;
              both)
                      screen_internal
                      ;;
              *)
                      screen_internal
                      ;;
      esac
}
 
# What should we do?
DO="$1"
if [ -z "$DO" ]; then
      if [ $(basename $0) = "thinkpad-fn-f7" ]; then
              DO="toggle"
      fi
fi
 
case "$DO" in
      toggle)
              screen_toggle
              ;;
      internal)
              screen_internal
              ;;
      external)
              screen_external
              ;;
      mirror)
              screen_mirror
              ;;
      both)
              screen_both
              ;;
      status)
              echo "Current Fn-F7 state is: $STATE"
              echo
              echo "Attached monitors:"
              $SU xrandr | grep "\Wconnected" | sed "s/^/ /"
              ;;
      *)
              echo "usage: $0 <command>" >&2
              echo >&2
              echo "  commands:" >&2
              echo "          status" >&2
              echo "          internal" >&2
              echo "          external" >&2
              echo "          mirror" >&2
              echo "          both" >&2
              echo "          toggle" >&2
              echo >&2
              ;;
esac

With the help of that script I tried to watch movies on external TV set. Unfortunately Xine and MPlayer can't send a valid image to the TV screen -- or at least I was unable to achieve it using D-Sub socket for video signal and headphones socket for audio signal. Fortunately VLC player available on Alien's homepage works well.

catkin 09-07-2010 04:10 PM

The script does work. At first both screens have the built in display resolution. After pressing the hot key that runs the script the built in display goes blank then the external is changed to its native resolution. This is probably hardware dependent but has worked with three different external displays.

EDIT:

The above was from memory and is not quite correct; observation shows that the external screen is blank until the script runs when it first displays the built in screen, tiled and then changes to native resolution. The desktop is Xfce.

saavedra29 09-08-2010 05:35 AM

Thank you very much for the replies!
However i didn't think i would get so confused with configuring the external screen.From all the searching i have come to 2 conclusions. I have either to get the external monitor to the top of the screen and the laptop's to the bottom and configure their resolutions separately or just use a script as you mention above and select, before running X, which screen will i use.
I like more the script solution but..do i have to configure the xorg.cong first to give the resolutions? If yes i don't know how to do this. I started reading the man xorg.conf but quitted as i didn't understand many things. I don't know what to replace and where. Can you help me at this?
And the other is that when i make the script and configure it with my needs i have to place it in a file so that it runs automaticly before running X. Do you know which is this file?

catkin 09-08-2010 06:32 AM

I do not have a /etc/X11/xorg.conf file.

You could run a script from the KDE session autostart facility (that is generic terminology -- I do not know what it is called in KDE-speak)

saavedra29 09-08-2010 07:21 AM

I made this script:
Code:

xrandr | grep VGA | grep " connected "

if [ $? -eq 0 ]; then
        xrandr --output LVDS --off --output VGA --mode 1440x900
fi

I putted it in /etc/X11/xinit/xinitrc but didn't work.
The same when i putted this in /etc/X11/xinit/xinitrc.kde
Then i made an *.sh file with it, gave permissions and pasted it in /home/slaris/.kde/Autostart.It didn't work too.
I am sure this will work, but i need to put it in the right file..
can you suggest any other files to try it?

(I boot with console and start kde with startX)

igadoter 09-08-2010 07:27 AM

@saavedra29
I don't understand. Do you want to disable the display of your notebook?

saavedra29 09-08-2010 07:31 AM

Quote:

Originally Posted by igadoter (Post 4091334)
@saavedra29
I don't understand. Do you want to disable the display of your notebook?

Yes. Disable it ( only if VGA is active ) and enable VGA ( the external ).

igadoter 09-08-2010 08:04 AM

Why don't you try a virtual desktop? Your monitors should work well with xinerama mode for 1280 height, LVDS 1280x800, VGA 1280x1024. What is a true size of VGA display? I mean in inches? Is it a large display?

saavedra29 09-08-2010 08:24 AM

The vga is 22' inches with maximum resolution 1680x1050, but i preffer 1440x900.
Xinerama, i think is a program that i have to download and install. But since i am new in slackware it will be a lot of trouble for me. Believe me.Also i wouldn't like to use the laptop's monitor, i don't really need it.


All times are GMT -5. The time now is 11:28 AM.