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
 

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