Auflösung ermitteln und ändern

März 5, 2011·
Julio Batista Silva
Julio Batista Silva
· 2 Min Lesezeit

Aktuelle Auflösung herausfinden

xdpyinfo  | grep 'dimensions:'

oder

xrandr | grep '*'

Auflösung ändern

Ohne weitere Konfiguration wies mein Awesome schlechte Auflösungen für den Notebook‑Monitor (LVDS1) und den per HDMI angeschlossenen TV zu:

julio@julio-acer ~> xrandr -q
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
LVDS1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 293mm x 164mm
   1366x768       60.0 +
   1024x768       60.0*
   800x600        60.3     56.2
   640x480        59.9
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 160mm x 90mm
   1920x1080      60.0 +   60.0
   1280x1024      60.0
   1280x720       60.0
   1024x768       60.0*
   800x600        60.3
   640x480        60.0     59.9
   720x400        70.1
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
TV1 unknown connection (normal left inverted right x axis y axis)
   848x480        30.0 +
   640x480        30.0 +
   1024x768       30.0
   800x600        30.0

Zum Beheben habe ich folgenden Befehl verwendet:

julio@julio-acer ~> xrandr - -output HDMI1 --auto
julio@julio-acer ~> xrandr - -output LVDS1 - -auto

Da ich den Notebook‑Bildschirm nicht brauche, kann ich ihn mit folgendem Befehl abschalten:

xrandr - -output LVDS1 - -off

Skripte

xrandir

Speichere das folgende Skript unter ~/Scripts/monitores und füge es dem .xinitrc hinzu:

#!/bin/bash

EXTERNAL_OUTPUT="HDMI1"
INTERNAL_OUTPUT="LVDS1"
# EXTERNAL_LOCATION may be one of: left, right, above, or below
EXTERNAL_LOCATION="right"

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

xrandr |grep $EXTERNAL_OUTPUT | grep " connected "
if [ $? -eq 0 ]; then
    xrandr --output $INTERNAL_OUTPUT --off --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION
else
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --off
fi

#END

Xorg

Eine andere Möglichkeit ist, /etc/X11/xorg.conf zu bearbeiten. Aus irgendeinem Grund hat der zweite Bildschirm dabei jedoch eine falsche Auflösung:

Section "Device"
    Identifier  "Card0"
    Driver      "intel"
    BusID       "PCI:0:2:0"
    Screen       0
EndSection

Section "Device"
    Identifier  "Card1"
    Driver      "intel"
    BusID       "PCI:0:2:0"
    Screen       1
EndSection

Section "Monitor"
    Identifier   "Televisao"
    Option       "Enable"    "true"
EndSection

Section "Monitor"
    Identifier   "Notebook"
    Option       "Enable"    "true"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor    "Televisao"
    DefaultDepth 24

    SubSectionSub "Display"
        Depth     24
        Modes    "1920x1080"
    EndSubSection
EndSection

Section "Screen"
    Identifier "Screen1"
    Device     "Card1"
    Monitor    "Notebook"
    DefaultDepth 24

    SubSectionSub "Display"
        Depth     24
        Modes    "1366x768"
    EndSubSection
EndSection

Section "ServerLayout"
    Identifier     "By Julio"
    Screen      0  "Screen0"
    Screen      1  "Screen1"
    Option    "Xinerama" "true"
EndSection

Julio Batista Silva
Autoren
Senior Cloud-Entwickler
comments powered by Disqus