Tag Archives: xorg.conf

解决vmware里面的xorg窗口管理器无法全屏的问题

最近正在用debian折腾各种窗口管理器,包括awesome,fluxbox,期间发现并解决了一个虚拟机里运行xorg无法全屏的问题。 环境: (1)OS: Debian GNU/Linux 6.0 \n \l Linux debian 2.6.32-5-686 #1 SMP Wed Jan 12 04:01:41 UTC 2011 i686 GNU/Linux 运行于vmware虚拟机里面;刚开始安装的是GNOME桌面环境,vmware-tools也已经安装好,GNOME下使用一切正常,没有什么大问题,包括全屏,和宿主机器之间复制,粘贴什么的;该系统用的是现成的vmware镜像文件,下载地址:http://www.trendsigma.net/vmware/debian6t.html

(2)vmware版本: 6.5.2 build-156735

由于系统太慢,跑这种大型的桌面环境太费劲,所以想着更换一些轻便的桌面环境或者窗口管理器,诸如openbox,blackbox,fluxbox,awesome等等都是很不错的选择;但是安装进入之后,在vmware里面无法全屏,即使vmware-tools已经正确安装。上网google半天,终于找到解决办法:基本思路就是自己生成xorg.conf文件,然后进行一些简单配置;以下是步骤。

1.进入console终端模式,也就是字符界面

如果用的是GNOME,按照网上说的方法,说是Ctrl + Alt + F2就能进入,但是我试了好几次都无法进入字符界面,所以我用的是另一种方法:删除/etc/X11/default-display-manager里面的/usr/sbin/gdm3,也就是登录的时候不要启动登录管理器gdm,这样启动之后就会自动进入字符界面了。

2.生成xorg.conf文件

这一步确保你已经安装好xorg;然后执行下列操作:

su #切换到root用户
Xorg -configure
cp /root/xorg.conf.new /etc/X11/xorg.conf

3.配置你的xorg.conf

两个地方,很重要:

Section "Monitor"
...
EndSection

Section "Screen"
...
EndSection

Monitor那里要加入HorizSync和VertRefresh属性,Screen那里要调整分辨率,下面是我的配置:

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
        HorizSync 1.0 - 10000.0
        VertRefresh 1.0 - 10000.0
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth 24
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes   "1440x900"
        EndSubSection
EndSection

换成你显示器的分辨率就行了重新startx就可以了。理论上,不管你用什么窗口管理器,安装vmware-tools之后按键”Ctrl + Alt + Enter”都能进入全屏模式。

最后贴上我的xorg.conf文件,仅供参考:

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/X11/misc"
        FontPath     "/usr/share/fonts/X11/cyrillic"
        FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"
        FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"
        FontPath     "/usr/share/fonts/X11/Type1"
        FontPath     "/usr/share/fonts/X11/100dpi"
        FontPath     "/usr/share/fonts/X11/75dpi"
        FontPath     "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
        FontPath     "built-ins"
EndSection

Section "Module"
        Load  "extmod"
        Load  "glx"
        Load  "record"
        Load  "dbe"
        Load  "dri2"
        Load  "dri"
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"
        HorizSync 1.0 - 10000.0
        VertRefresh 1.0 - 10000.0
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     "HWcursor"                  # [<bool>]
        #Option     "Xinerama"                  # [<bool>]
        #Option     "StaticXinerama"            # <str>
        #Option     "AddDefaultMode"            # [<bool>]
        Identifier  "Card0"
        Driver      "vmwlegacy"
        VendorName  "VMware"
        BoardName   "SVGA II Adapter"
        BusID       "PCI:0:15:0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth 24
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes   "1440x900"
        EndSubSection
EndSection

参考文献