Magellan Linux

Diff of /alx-src/branches/alxconf-060/functions/config_x11.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2036 by niro, Mon May 9 14:57:16 2011 UTC revision 2037 by niro, Wed May 11 09:14:50 2011 UTC
# Line 27  get_x11_settings() Line 27  get_x11_settings()
27    
28   # which input devices are we using ?   # which input devices are we using ?
29   ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'")   ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'")
  ALX_MOUSE_RESOLUTION=$(mysqldo "select mouse_resolution from cfg_input where serial='${ALX_SERIAL}'")  
30   export ALX_MOUSE   export ALX_MOUSE
31  }  }
32    
# Line 37  config_display_manager() Line 36  config_display_manager()
36   cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf   cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf
37   sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf   sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf
38    
  # setup xession  
  sed -i "s:\(^GLOGIN=\).*:\1slim:" /etc/rc.config  
   
39   # windowmanager   # windowmanager
40   echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc   echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc
41  }  }
42    
 clearconfig()  
 {  
  local xfconfig="/etc/X11/xorg.conf"  
  :> ${xfconfig}  
 }  
   
 addconfig()  
 {  
  local value="$@"  
  local xfconfig="/etc/X11/xorg.conf"  
   
  echo "${value}" >> ${xfconfig}  
 }  
   
43  config_x11()  config_x11()
44  {  {
45   # get our settings from the db   local has_tigervnc
46     local CONFIG
47    
48     # get our settings f2rom the db
49   get_x11_settings   get_x11_settings
50    
51   # setup displaymanager   # setup displaymanager
52   config_display_manager   config_display_manager
53    
  local xserver=Xorg  
  local HAS_TIGERVNC  
   
54   # got we vnc support ?   # got we vnc support ?
55   if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]   if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]
56   then   then
57   HAS_TIGERVNC="yes"   has_tigervnc="yes"
58   else   else
59   HAS_TIGERVNC="no"   has_tigervnc="no"
60   fi   fi
61    
62   # show which server we use   # show which server we use
63   echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "   echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "
64    
65   # show if we have vnc   # show if we have vnc
66   if [[ ${HAS_TIGERVNC} = yes ]]   if [[ ${has_tigervnc} = yes ]]
67   then   then
68   echo "with tigervnc enabled ..."   echo "with tigervnc enabled ..."
69   else   else
70   echo "..."   echo "..."
71   fi   fi
72    
73   # create a new clear xfconfig file   # set_input_keyboard
74     CONFIG="/etc/X11/xorg.conf.d/25-layout.conf"
75   clearconfig   clearconfig
76   addconfig '# Generated with alxconfig-ng.'   addconfig 'Section "InputClass"'
77   addconfig   addconfig ' Identifier "keyboard layout"'
78     addconfig ' MatchIsKeyboard "on"'
79   # write modules   addconfig ' Option "XkbLayout" "de"'
  addconfig  
  addconfig 'Section "Module"'  
  addconfig '    Load        "dbe"'  
  addconfig '    SubSection  "extmod"'  
  addconfig '      Option    "omit xfree86-dga"'  
  addconfig '    EndSubSection'  
  addconfig '    Load        "freetype"'  
  addconfig '#    Load       "glx"'  
  addconfig '    Load       "dri"'  
   
  [[ ${HAS_TIGERVNC} = yes ]] && addconfig '    Load       "vnc"'  
   
  addconfig 'EndSection'  
   
  # fonts  
  addconfig  
  addconfig 'Section "Files"'  
  # only add existing font pathes  
  [[ -f /usr/share/fonts/local/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/local/"'  
  [[ -f /usr/share/fonts/misc/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/misc/"'  
  [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/75dpi/:unscaled"'  
  [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/100dpi/:unscaled"'  
  [[ -f /usr/share/fonts/TrueType/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/TrueType/"'  
  [[ -f /usr/share/fonts/freefont/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/freefont/"'  
  [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/75dpi/"'  
  [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/100dpi/"'  
  addconfig 'EndSection'  
   
  # server flags  
  addconfig  
  addconfig 'Section "ServerFlags"'  
  addconfig '#    Option "DontVTSwitch"'  
  addconfig '#    Option "DontZap"'  
  addconfig '#    Option "Dont Zoom"'  
80   addconfig 'EndSection'   addconfig 'EndSection'
81    
82   # keyboard   # graphic driver
83   addconfig   CONFIG="/etc/X11/xorg.conf.d/25-device.conf"
84   addconfig 'Section "InputDevice"'   clearconfig
85   addconfig '    Identifier "Keyboard1"'   addconfig 'Section "Device"'
86   addconfig '    Driver "kbd"'   addconfig ' Identifier "Card0"'
87   addconfig '    Option "AutoRepeat" "500 30"'   addconfig " Driver \"${ALX_MODULE}\""
  addconfig '#    Option "Xleds"      "1 2 3"'  
  addconfig '    Option "XkbRules" "xorg"'  
  addconfig '    Option "XkbModel" "pc105"'  
  addconfig '    Option "XkbLayout" "de"'  
88   addconfig 'EndSection'   addconfig 'EndSection'
89    
90   # mouse   # vnc module
91   addconfig   if [[ ${has_tigervnc} = yes ]]
92   addconfig 'Section "InputDevice"'   then
93   addconfig '    Identifier "Mouse1"'   CONFIG="/etc/X11/xorg.conf.d/25-module.conf"
94   addconfig '    Driver "mouse"'   clearconfig
95   addconfig "    Option \"Protocol\"    \"${ALX_MOUSE}\""   addconfig 'Section "Module"'
96   local device   addconfig ' Load vnc'
97   case ${ALX_MOUSE} in   addconfig 'EndSection'
98   IMPS/2|PS/2) device=/dev/psaux;;   fi
  Auto) device=/dev/mouse;;  
  *) device=/dev/mouse;;  
  esac  
  addconfig "    Option \"Device\"      \"${device}\""  
  [[ -z ${ALX_MOUSE_RESOLUTION} ]] && ALX_MOUSE_RESOLUTION="1200"  
  addconfig "    Option \"Resolution\" \"${ALX_MOUSE_RESOLUTION}\""  
  [[ ${ALX_MOUSE} = IMPS/2 ]] && addconfig '    Option "ZAxisMapping" "4 5"'  
  addconfig 'EndSection' >> ${xfconfig}  
99    
100   # monitor   # monitor
101   addconfig   CONFIG="/etc/X11/xorg.conf.d/25-monitor.conf"
102     clearconfig
103   addconfig 'Section "Monitor"'   addconfig 'Section "Monitor"'
104   addconfig '    Identifier  "Monitor0"'   addconfig ' Identifier "Monitor0"'
105   addconfig '    Option      "DPMS"'   addconfig ' Option     "DPMS"'
106    
107   # add hsync, vrefresh   # add hsync, vrefresh
108   if [[ -x /sbin/ddcxinfo-knoppix ]]   if [[ -x /sbin/ddcxinfo-knoppix ]]
# Line 174  config_x11() Line 112  config_x11()
112   # fallback   # fallback
113   [[ ${hsync} = 0-0 ]] && hsync="28-96"   [[ ${hsync} = 0-0 ]] && hsync="28-96"
114   [[ ${vsync} = 0-0 ]] && vsync="50-60"   [[ ${vsync} = 0-0 ]] && vsync="50-60"
115    
116   addconfig   addconfig
117   addconfig "    HorizSync ${hsync}"   addconfig " HorizSync ${hsync}"
118   addconfig "    VertRefresh ${vsync}"   addconfig " VertRefresh ${vsync}"
119   fi   fi
120    
121   # add cvt modelines   # add cvt modelines
122   addconfig   addconfig
123   local cvt="/usr/X11R6/bin/cvt"   local cvt="/usr/X11R6/bin/cvt"
124   local modeline   local modeline
125   modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')   modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
# Line 194  config_x11() Line 132  config_x11()
132   fi   fi
133   addconfig 'EndSection'   addconfig 'EndSection'
134    
135   # vga   # screen
136   addconfig   CONFIG="/etc/X11/xorg.conf.d/25-screen.conf"
137   addconfig 'Section "Device"'   clearconfig
  addconfig '    Identifier  "vga0"'  
  # check for openchrome and use it if available  
  if [[ ${ALX_MODULE} = via ]] && [ -f /usr/X11R6/lib/xorg/modules/drivers/openchrome_drv.so ]  
  then  
  ALX_MODULE="openchrome"  
  fi  
  addconfig "    Driver      \"${ALX_MODULE}\""  
  addconfig 'EndSection'  
   
  # screens  
  addconfig  
138   addconfig 'Section "Screen"'   addconfig 'Section "Screen"'
139   addconfig '    Identifier  "Screen 1"'   addconfig ' Identifier "Screen0"'
140   addconfig '    Device      "vga0"'   addconfig ' Monitor "Monitor0"'
141   addconfig '    Monitor     "Monitor0"'   addconfig " DefaultDepth ${ALX_DEPTH}"
142   addconfig "    DefaultDepth ${ALX_DEPTH}"   addconfig ' SubSection "Display"'
143   addconfig '    Subsection "Display"'   addconfig " Depth ${ALX_DEPTH}"
144   addconfig "        Depth       ${ALX_DEPTH}"   addconfig " Modes \"${ALX_RESOLUTION}\""
145   addconfig "        Modes       \"${ALX_RESOLUTION}\""   addconfig ' ViewPort 0 0'
146   addconfig '        ViewPort    0 0'   addconfig ' EndSubSection'
147   addconfig '    EndSubsection'   # vnc auth
148   if [[ ${HAS_TIGERVNC} = yes ]]   if [[ ${has_tigervnc} = yes ]]
149   then   then
150   addconfig '    Option "SecurityTypes" "VncAuth"'   addconfig ' Option "SecurityTypes" "VncAuth"'
151   addconfig '    Option "UserPasswdVerifier" "VncAuth"'   addconfig ' Option "UserPasswdVerifier" "VncAuth"'
152   addconfig '    Option "PasswordFile" "/root/.vnc/passwd"'   addconfig ' Option "PasswordFile" "/root/.vnc/passwd"'
153   fi   fi
154   addconfig 'EndSection'   addconfig 'EndSection'
155    
  # server layout  
  addconfig  
  addconfig 'Section "ServerLayout"' >> ${xfconfig}  
  addconfig '    Identifier  "Simple Layout"' >> ${xfconfig}  
  addconfig '    Screen "Screen 1"' >> ${xfconfig}  
  addconfig '    InputDevice "Mouse1" "CorePointer"' >> ${xfconfig}  
  addconfig '    InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig}  
  addconfig 'EndSection' >> ${xfconfig}  
   
  # dri  
  addconfig  
  addconfig 'Section "DRI"' >> ${xfconfig}  
  addconfig '    Mode 0666' >> ${xfconfig}  
  addconfig 'EndSection' >> ${xfconfig}  
156  }  }

Legend:
Removed from v.2036  
changed lines
  Added in v.2037