Xorg&Xinitrc

http://www.xfree86.org/current/X.7.html

https://www.x.org/releases/X11R7.7/doc/man/man5/xorg.conf.5.xhtml

http://www.linuxfromscratch.org/blfs/view/svn/index.html

http://www.linuxfromscratch.org/blfs/view/svn/x/xorg-config.html

 

TWM 是TabWindow Manager for the X WindowSystem的简称,它是一个窗口管理器,初次发布于1988年4月,是个非常容易上手的WindowManager。不像其他的X程序,它没有基于任何GUI组件,而是直接使用的XLib,这样带来的好处就是:小、更方便的配置。

所谓窗口管理器,它是一个特殊的程序,它用来给X程序提供诸如:标题的绘制、窗口阴影、窗口图标化、用户自定义宏、鼠标点击、键盘焦点、缩放等功能。  它和GNOME、KDE不同,不是一个桌面环境(DesktopEnviroment,DE)。那些所谓的桌面环境都会有一个窗口管理器,比如CentOS的GNOME用的就是MetaCity,这些DE集成了大量的应用程序,包括一些非常便利的系统管理工具、实用小工具、游戏等,大大方便了用户。  桌面环境纵有千般好,也会有它的短处,比如:由于它的庞大,在系统启动的时候会显的很慢,其实有很多应用我们都不会用到,这个时候,你可选择只加载一个窗口管理器即可。而且你将会发现,几乎所有的窗口管理器都可以用rc文件来配置,你可以在允许的范围内,任意的配置。比如TWM的配置文件就是.twmrc。它位于用户目录下,在TWM启的时候它会首先从用户的主目录下找这个文件,如果它找不到,TWM就会使用一个系统共用的配置文件,一般情况下它位于:/usr/X11R6/lib/X11/twm/system.twmrc。  

为了要启动TWM,而不是GNOME或KDE,我们需要在用户的目录下编辑一个.xinitrc的文件,

它的内容如下:  

#!/bin/sh

xclock -geometry 70x70+5+5 &   

xterm -geometry +200+200 -fn 7x13 -fg gray -bg black

&exec twm

这样,当你在执行startx的时候,就只会启动TWM了。最后一行表示启动TWM,前面的两行表示启动的其他程序,比如xclock,它是一个时钟程序,它后面的参数表示它启动后所在的位置和大小。需要注意的是,除了最后一行,其他的行要在最后加上后台运行标志,否则后面的程序都没法进行了。除了最后一行,其他的都是可选的,你可以把你常用的一些程序放在exectwm前,这就和Windows下的启动一样。startx后,你将会发现,TWM的启动非常的快,至少比GNOME,KDE快多了,当然这样比有失公平。  TWM的配置逻辑上被分为三类概念:变量(Variables)、绑定(Bindings)和菜单(Menus)。它们都保存在用户目录下的.twmrc文件中。

       恢复

       #yum remove gnome-desktop

  #yum install gnome*

  #switchdesk

  选择gnome-desktop桌面

  OK,重启,问题解决。

 

systemctl  get-default

systemctl  set-default  multi-user.target

systemctl  set-default   graphical.target


Xorg.conf生成

1. 在命令行下切换到root身份;

2. 执行命令“ cp /var/log/Xorg.0.log /var/log/Xorg.1.log";

3. 执行命令” Xorg -configure :1";

4. 执行命令3后 xorg.conf.new 在 /root/ 目录下生成,该文件可以做为当前系统的xorg.conf的基本模板使用了

总结 

1、xrandr 使用

     xrandr --listprovider    

                --listactivemonitor  

               --listmonitor

2、wm 

  twm

wmx

icewm

jwm

   新增 $home/.xinitrc 借鉴 /etc/X11/xinit/xinitrc

3、举例

1)  一个显卡一个screen

Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1"  LeftOf "Screen0"
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
        Option "Xinerama" "on"
        Option "Clone" "off"
EndSection

Section "Files"
    ModulePath   "/usr/lib/xorg/modules"
    FontPath     "catalogue:/etc/X11/fontpath.d"
    FontPath     "built-ins"
EndSection

Section "Module"
    Load  "dbe"
    Load  "dri2"
    Load  "extmod"
    Load  "dri"
    Load  "glx"
    Load  "record"
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 30.0-60
    VertRefresh 50-85
Modeline "800x600_60.00"   38.25  800 832 912 1024  600 603 607 624 -hsync +vsync
Modeline "800x600_70.00"   45.50  800 840 920 1040  600 603 607 628 -hsync +vsync
Modeline "800x600_72.00"   47.00  800 840 920 1040  600 603 607 628 -hsync +vsync
Modeline "800x600_75.00"   49.00  800 840 920 1040  600 603 607 629 -hsync +vsync
    Option "preferredMode"  "800x600" 

EndSection

Section "Monitor"
     Identifier   "Monitor1"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
    HorizSync 30.0-60
    VertRefresh 50-85
Modeline "800x600_60.00"   38.25  800 832 912 1024  600 603 607 624 -hsync +vsync
    Option "preferredMode"  "800x600" 
    
EndSection

Section "Device"
    Identifier  "Card0"
    Driver      "intel"
    BusID       "PCI:00:02:0"
    Option "monitor-LVDS1" "Monitor0"
    Option "monitor-VGA1"  "Monitor1"
EndSection

Section "Monitor"
    Identifier   "Monitor2"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
EndSection

Section "Device"
    Identifier  "Card1"
    Driver      "ati"
    BusID       "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card1"
        DefaultDepth 24
    SubSection "Display"
        Viewport   0 0
        Depth     24
        Modes "800x600"
    EndSubSection
EndSection

Section "Screen"
    Identifier "Screen1"
    Monitor    "Monitor2"
    Device     "Card0"
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection

2)一个显卡多个monitor
     一个device配置多个Option,    monitor 中顺序;必有randr支持的分辨率

Section "Device"
    Identifier  "Card0"
    Driver      "modesetting"
    BusID       "PCI:0:1:0"
    Option        "monitor-DP-1"    "Monitor0"
    Option        "monitor-HDMI-1"    "Monitor1"
    Option        "monitor-HDMI-2"    "Monitor2"   
EndSection
 

   Section "Monitor"
    Identifier   "Monitor0"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
    Option "PreferredMode"  "1024x768"
EndSection
Section "Monitor"
    Identifier   "Monitor1"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
    Option "PreferredMode"  "1920x1080"
    Option        "RightOf"    "Monitor0"
EndSection

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

 第二再例

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     "catalogue:/etc/X11/fontpath.d"
    FontPath     "built-ins"
EndSection

Section "Module"
    Load  "glx"
    Load  "extmod"
    Load  "dri2"
    Load  "record"
    Load  "dbe"
    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 30.0-60
    VertRefresh 50-85
Modeline "800x600_60.00"   38.25  800 832 912 1024  600 603 607 624 -hsync +vsync
Modeline "800x600_70.00"   45.50  800 840 920 1040  600 603 607 628 -hsync +vsync
Modeline "800x600_72.00"   47.00  800 840 920 1040  600 603 607 628 -hsync +vsync
Modeline "800x600_75.00"   49.00  800 840 920 1040  600 603 607 629 -hsync +vsync
    Option "preferredMode"  "800x600" 
    
EndSection
Section "Monitor"
     Identifier   "Monitor1"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
    HorizSync 30.0-60
    VertRefresh 50-85
Modeline "800x600_60.00"   38.25  800 832 912 1024  600 603 607 624 -hsync +vsync
    Option "preferredMode"  "800x600" 
    Option "RightOf"   "Monitor0"
EndSection
Section "Device"
    Identifier  "Card0"
    Driver      "intel"
    BusID       "PCI:00:02:0"
    Option "monitor-LVDS1" "Monitor0"
    Option "monitor-VGA1"  "Monitor1"
EndSection
Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
        DefaultDepth 24
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection

Section  "ServerFlags"
   Option  "DontVTSwitch"    "on"
   Option  "DontZap"         "on"
   Option  "blank time"      "0"
   Option  "standby time"    "0"
   Option  "suspend time"    "0"
   Option  "off time"        "0"
EndSection
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章