[转]Linux 配置双显示器 (原文名: Ubuntu 8.04/8.10 设置笔记本电脑双显示器)

来源:互联网 发布:斗鱼不承认淘宝鱼丸 编辑:程序博客网 时间:2024/05/16 13:47

Ubuntu 8.04/8.10 设置笔记本电脑双显示器

目录:
1、设置显示分辨率及 xrandr 介绍
2、GNOME下切换双屏的方法
3、关于双屏下 GNOME面板/ wine / 阿里旺旺的一些问题及解决

正文:

1. 设置显示分辨率及 xrandr 介绍

   X Windows 中有一个显示分辨率的概念,在默认情况下,这个显示分辨率为 max*max ,max等于你的所有连接上的显示器中最大分辨率中的最大值。例如我的笔记本液晶屏最大分辨率为 1024*768,外接显示器最大分辨率为 1280*1024,则默认的显示分辨率为 1280*1280。如果我设置左右双屏且使用最大分辨率,那么总显示分辨率就会达到2304*1024,达到超出系统默认的大小。在这种情况下强行设置双屏幕,就会导致 X 进入超低分辨率,结果不得不手工重设 xrog.conf 来恢复。
  为了更好检测这个问题,我们需要用到 xrandr 这个软件,xrandr系统已经自带,如果没有请安装x11-xserver-utils:sudo apt-get install x11-xserver-utils 。
  不带参数执行xrandr能够列出当前的显示设备和每个设备支持的模式。Screen代表了总显示区域,VGA代表显示器,LVDS代表笔记本液晶屏。

Screen 0: minimum 320 x 200, current 1280 x 768, maximum 1280 x 1280
VGA connected (normal left inverted right x axis y axis)
   1280x1024      75.0 +   69.8     59.9  
   1024x768       75.1     70.1     60.0  
   800x600        72.2     75.0     60.3  
   640x480        75.0     72.8     65.4     60.0  
   720x400        70.1  
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 246mm x 184mm
   1024x768       50.0*+   60.0     40.0  
   800x600        60.3  
   640x480        60.0     59.9  

  系统默认显示分辨率为 1280x1280,而在左右扩展双屏情况下VGA和LVDS支持的最小分辨率加在一起都超过这个数字,当然会导致 X 进入超低分辨率了。如果感兴趣,可以用以下命令尝试把外接显示器打开并设置为右侧扩展屏幕(不用sudo)来验证一下: xrandr --output VGA --auto --right-of LVDS
系统会出错,提升说屏幕大小超出限制。

  解决方法:手工修改xorg.conf,在Section "Screen"中添加一行 Virtual 2304 1024

Section "Screen"
   Identifier "Default Screen"
   Monitor "Configured Monitor"
   Device "Configured Video Device"
   SubSection "Display"
      Virtual 2304 1024
   EndSubSection
EndSection

注意:Ubuntu 8.04中的xorg.conf已经非常精简,Subsection "Display" 可能要自己添加,别忘记 EndSubSection

我设置好以后的xrandr命令输入如下:
$ xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2304 x 1024
VGA connected (normal left inverted right x axis y axis)
....
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 246mm x 184mm
....

  现在应该没问题了,用刚才的命令打开双屏后,
$ xrandr
Screen 0: minimum 320 x 200, current 2304 x 1024, maximum 2304 x 1024
VGA connected 1280x1024+1024+0 (normal left inverted right x axis y axis) 340mm x 270mm
...
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 246mm x 184mm
...

  其实这个显示分辨率完全可以设置高一些,比如我就设置成4000 x 2000,如果连接到最大分辨率为1920x1200的外接显示器,也不用重新设置 xorg.conf 了。

  xrandr 命令行可以很方便地切换双屏,常用方式如下,其他的可以自己探索:
  • xrandr --output VGA --same-as LVDS --auto
    打开外接显示器(最高分辨率),与笔记本液晶屏幕显示同样内容(克隆)
  • xrandr --output VGA --same-as LVDS --mode 1024x768
    打开外接显示器(分辨率为1024x768),与笔记本液晶屏幕显示同样内容(克隆)
  • xrandr --output VGA --right-of LVDS --auto
    打开外接显示器(最高分辨率),设置为右侧扩展屏幕
  • xrandr --output VGA --off
    关闭外接显示器
  • xrandr --output VGA --auto --output LVDS --off
    打开外接显示器,同时关闭笔记本液晶屏幕(只用外接显示器工作)
  • xrandr --output VGA --off --output LVDS --auto
    关闭外接显示器,同时打开笔记本液晶屏幕 (只用笔记本液晶屏)
(最后两种情况请小心操作,不要误把两个屏幕都关掉了。。。。)

2. GNOME下切换双屏的方法


   用命令行毕竟不方便,幸好我们还有许多 X 下的工具可用:
  GNOME 中自带的“监视器屏幕分辨率设置”软件功能很强大(系统->首选项->屏幕分辨率), 打开和关闭第二个监视器的办法是调整它的分辨率,取消“克隆”就可以设置成扩展屏幕,还可以通过拖动图标位置调整双屏时两个屏幕的相对位置。
     
  grandr,则是一个图形界面的xrandr前端,功能与前一个软件各有千秋。安装方法:sudo apt-get install grandr
     
   另外还有两个可以添加到GNOME面板上的快速切换分辨率(但不能切换双屏)的插件,分别是 gnome-randr-applet 和 resapplet,如果你需要可以尝试一下。
   对于 Nvidia显卡,据说可以安装 nvidia-settings (sudo apt-get install nvidia-settings),但我没试验过。

3. 关于双屏下 GNOME面板/ wine / 阿里旺旺的一些问题及解决


   右侧扩展屏幕时,GNOME面板会自动跑到外接显示器上去,可以通过拖动把它放回到笔记本液晶屏上来。
    发现一个有趣的现象,用wine执行的程序,似乎只能在最初显示的那个屏幕上显示,拖到另外一个屏幕上就无法正常渲染了。
    关于在双屏情况下使用阿里旺旺5.7,有一个注意事项,启动扩展双屏后,再启动阿里旺旺会看不到图标,在托盘区只看到一个空白的图标,无法启动菜单,所以最好先启动阿里旺旺,然后再启动扩展双屏。(如果已经启动了双屏,那么可以先把双屏模式变成非扩展模式,然后启动旺旺,再打开扩展模式即可)。命令如下:
xrandr --output VGA --same-as LVDS
启动旺旺
xrandr --output VGA --right-of LVDS



PS by Me:
xrandr 真是个好东西呀!!

顺便贴下我的 xorg.conf (ATI X1250)
Section "ServerLayout"    Identifier     "Default Layout"    Screen      0  "aticonfig-Screen[0]" 0 0    InputDevice    "Keyboard0" "CoreKeyboard"#    InputDevice "Synaptics" "AlwaysCore"    InputDevice "USB Mouse" "AlwaysCore"    Option "AIGLX" "0"EndSectionSection "ServerFlags"    Option  "AllowMouseOpenFail" "true"EndSectionSection "Device"    Identifier  "ati-x1250"    Driver  "radeon"    Option  "AGPFastWrite"        "True"    Option  "AGPMode" "4"    Option  "AccelDFS"       "true"    Option  "AccelMethod"        "EXA"    Option  "AccelMethod" "exa"    Option  "ColorTiling" "on"    Option  "DRI" "on"    Option  "Dac6Bit"        "True"    Option  "DynamicClocks"      "on"    Option  "EnablePageFlip"     "on"    Option  "FBTexPercent"       "0"    Option  "MonitorLayout"      "LVDS"    Option  "XAANoOffscreenPixmaps"  "true"EndSectionSection "InputDevice"    Identifier  "USB Mouse"    Driver  "mouse"    Option  "Device" "/dev/input/mice"    Option  "SendCoreEvents" "true"    Option  "Protocol" "IMPS/2"    Option  "ZAxisMapping" "4 5"    Option  "Buttons" "5"EndSectionSection "InputDevice"    Identifier  "Synaptics"    Driver      "synaptics"    Option      "Protocol" "auto-dev"    Option      "UpDownScrolling" "on"    Option      "LeftRightScrolling" "on"    Option      "LeftEdge" "100"    Option      "RightEdge" "900"    Option      "TopEdge" "80"    Option      "BottomEdge" "680"    Option      "FingerLow" "25"    Option      "FingerHigh" "30"    Option      "MaxTapTime" "1000"    Option      "MaxTapMove" "220"    Option      "VertScrollDelta" "100"    Option      "MinSpeed" "0.6"    Option      "MaxSpeed" "1"    Option      "SHMConfig" "on"    Option      "SHMConfig" "1"EndSectionSection "DRI"   Group "video"    Mode 0666EndSectionSection "Extensions"    Option "Composite" "0"EndSectionSection "Files"    FontPath "/usr/share/fonts/misc"    FontPath "/usr/share/fonts/corefonts"    FontPath "/usr/share/fonts/TTF"    FontPath "/usr/share/fonts/100dpi"    FontPath "/usr/share/fonts/75dpi"    FontPath "/usr/share/fonts/default/ghostscript"    FontPath "/usr/share/fonts/misc/"    FontPath "/usr/share/fonts/TTF/"    FontPath "/usr/share/fonts/OTF"    FontPath "/usr/share/fonts/Type1/"    FontPath "/usr/share/fonts/100dpi/"    FontPath "/usr/share/fonts/75dpi/"    ModulePath "/usr/lib/xorg/modules"EndSectionSection "Module"    Load    "GLcore"    Load    "bitmap"    Load    "dbe"    Load    "ddc"    Load    "dri"    Load    "extmod"    Load    "glx"    Load    "record"    Load    "vbe"    Load  "drm"EndSectionSection "InputDevice"    Identifier  "Keyboard0"    Driver  "kbd"    Option  "CoreKeyboard"    Option  "XkbRules" "xorg"    Option  "XkbModel" "pc105"    Option  "XkbVariant" ",winkeys"    Option  "XkbLayout" ""EndSectionSection "Monitor"    Identifier   "ASUS-LCD"    Option      "DPMS" "true"EndSectionSection "Screen"    Identifier "aticonfig-Screen[0]"    Device     "ati-x1250"    Monitor    "ASUS-LCD"    DefaultDepth     24   SubSection "Display"       Virtual 4000 2000        Depth   24        Viewport   0 0   EndSubSectionEndSection       
	
				
		
原创粉丝点击