3 # Purpose: wrapper for startx on grml [providing new xconfiguration tool]
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 # Latest change: Don Jul 12 01:20:47 CEST 2007 [mika]
8 ################################################################################
11 # usage: DEBUG=1 grml-x ..... 2>/tmp/grml-x-debug.log
12 if [[ $DEBUG -gt 0 ]]; then
17 # functions and color {{{
18 # use colors only if not booted with nocolor bootoption
19 if ! grep -q nocolor /proc/cmdline ; then
20 autoload colors ; colors
21 [ -r /etc/grml_colors ] && . /etc/grml_colors
24 # some functions like getBootParam
25 if [ -r /etc/grml/script-functions -a -r /etc/grml/sh-lib ] ; then
26 source /etc/grml/script-functions
27 source /etc/grml/sh-lib
29 echo 'Error: sourcing function files failed. Exiting.'
33 check4root &>/dev/null && ROOT='1' || ROOT=''
38 HWINFO='/usr/sbin/hwinfo'
40 [ -n "$XINITRC" ] || XINITRC="$HOME/.xinitrc"
43 HWINFO_TMP="/tmp/hwinfo.$$"
44 MONITORINFO="/tmp/monitorinfo.$$"
45 MOUSEINFO="/tmp/mouse.$$"
47 if [ -r /etc/sysconfig/keyboard ] ; then
48 source /etc/sysconfig/keyboard
54 XCONFIG='/etc/X11/xorg.conf'
55 KEYBOARD="# Driver \"kbd\"
56 # Option \"XkbRules\" \"xfree86\"
57 # Option \"XkbRules\" \"xorg\"
58 # Option \"XkbModel\" \"pc105\"
59 # Option \"XkbLayout\" \"${XKEYBOARD},us\"
60 # Option \"XkbVariant\" \"nodeadkeys\""
63 if [ -d /usr/share/fonts/X11 ] ; then
64 XFONTS=" FontPath \"/usr/share/fonts/X11/misc\"
65 FontPath \"/usr/share/fonts/X11/100dpi/:unscaled\"
66 FontPath \"/usr/share/fonts/X11/75dpi/:unscaled\"
67 FontPath \"/usr/share/fonts/X11/Type1\"
68 FontPath \"/usr/share/fonts/X11/100dpi\"
69 FontPath \"/usr/share/fonts/X11/75dpi\""
71 # /usr/X11R6/lib/X11/fonts exists nearly everywhere, assume
72 # /usr/X11R6/lib/X11/fonts as valid font path only if fonts.dir
74 if [ -r /usr/X11R6/lib/X11/fonts/misc/fonts.dir ] ; then
76 FontPath \"/usr/X11R6/lib/X11/fonts/Type1\"
77 FontPath \"/usr/X11R6/lib/X11/fonts/misc:unscaled\"
78 FontPath \"/usr/X11R6/lib/X11/fonts/misc\"
79 FontPath \"/usr/X11R6/lib/X11/fonts/75dpi:unscaled\"
80 FontPath \"/usr/X11R6/lib/X11/fonts/75dpi\"
81 FontPath \"/usr/X11R6/lib/X11/fonts/100dpi:unscaled\"
82 FontPath \"/usr/X11R6/lib/X11/fonts/100dpi\""
86 # make sure we don't leave any temp files {{{
88 rm -f "$HWINFO_TMP" "$MONITORINFO" "$MOUSEINFO"
89 [ -n "$1" ] && EXIT="$1" || EXIT="1"
90 print "$bg[black]$fg[red]${bold_color}Exiting...${reset_color}">&2
97 # warn if running as user root {{{
98 if [ -n "$ROOT" ] ; then
99 if [ -r /etc/grml_cd ] ; then
100 print "$bg[black]$fg[red]${bold_color}Warning: Please do not run grml-x as user root.${reset_color}"
101 print "$bg[black]$fg[red]${bold_color}Running grml-x as user root is *not* supported!${reset_color}"
102 print "$bg[black]$fg[red]${bold_color}Switch to user grml or run su - grml -c 'grml-x ...' instead.${reset_color}"
105 print "$bg[black]$fg[red]${bold_color}Warning: Please do not run X.org as user root!${reset_color}"
106 print "$bg[black]$fg[red]${bold_color}As soon as you have a working $XCONFIG please use startx instead of grml-x.${reset_color}"
110 fstabuser=$(grep ':x:1000:' /etc/passwd)
111 fstabuser=${fstabuser%%[:]*}
114 # usage information {{{
117 if [[ $1 != '' ]] ; then echo 1>&2 "\n$1" ; fi
118 print "$bg[black]$fg[red]$bold_color"
121 $PROGRAMNAME [-options] windowmanager
127 $PROGRAMNAME -force -nostart fluxbox
128 $PROGRAMNAME -nosynaptics fluxbox
129 $PROGRAMNAME -nosync fluxbox
130 $PROGRAMNAME -noddc wmii
131 $PROGRAMNAME -module radeon -mode 1024x768 -vsync 60 wmi
132 XINITRC=~/.xinitrc $PROGRAMNAME ion
133 $PROGRAMNAME -display 8 wmii
135 More information on grml-x can be found in the manual page: man grml-x
137 Report bugs, send wishes and feedback to the grml team:
138 http://grml.org/bugs/ - contact (at) grml.org
140 print "${reset_color}"
148 if [ -n "$ROOT" ] ; then
149 su - $fstabuser -c "$HWINFO > $HWINFO_TMP"
151 $HWINFO > $HWINFO_TMP
159 sudo $HWINFO --monitor > $MONITORINFO
166 [ -r "$MONITORINFO" ] || monitor # get monitor settings
167 modes=$(perl -e 'while (<STDIN>) {if (/ Resolution:/) { s/.*\s+(\d+x\d+).*/$1/; print} }' < $MONITORINFO |
168 sort -nur | perl -ne 's/\s+/ /; s/(\d+x\d+)/"$1"/; print')
170 if [ -n "$XINERAMA" ] ; then
174 Option for $fg[yellow]Xinerama$fg[green] found, please use xrandr inside X.org for your further configuration!
175 Trying to identify monitors now..."
177 # make sure we have information from 2 monitors:
178 # - first one from 'hwinfo --monitor' => $MONITORINFO
179 # - second one from 'hwinfo --framebuffer' => $FRAMEBUFFER
180 FRAMEBUFFER=$(hwinfo --framebuffer | grep 'Mode 0x.* bits' | head -1)
181 if [ -z "$FRAMEBUFFER" ] ; then
183 Fatal: could not identify two monitors - no chance to
184 set up multihead using Xinerama - sorry. :-(
186 Please run grml-x without the -xinerama option and contact
187 grml developers if you have any further useful information.
188 => http://grml.org/bugs/
193 # check whether we can read the $MONITORINFO file
194 if ! [ -r "$MONITORINFO" ] ; then
196 Fatal: could not identify monitor - no chance to
197 set up multihead using Xinerama - sorry. :-(
201 # Currently we only know that it works with current intel driver,
202 # so inform user about that:
203 if [[ "$MODULE" != "intel" ]] ; then
206 Warning: using a non-intel driver - trying Xinerama setup anyway.
207 If it worked please contact grml developers providing information
208 about your setup so we can adjust grml-x according!
210 -> http://grml.org/contact/
212 Sleeping for 10 seconds now... Will continue then...
213 Just press Ctrl-C to cancel operation.
218 # now calculate Virtual size for use with Xinerama
219 HORIZ_RES1="$(grep 'Max. Resolution:' $MONITORINFO | sed 's/ Max\. Resolution: \(.*\)x\(.*\)/\1/')"
220 VERIZ_RES1="$(grep 'Max. Resolution:' $MONITORINFO | sed 's/ Max\. Resolution: \(.*\)x\(.*\)/\2/')"
222 HORIZ_RES2="$(echo $FRAMEBUFFER | sed 's/ Mode 0x.*: \(.*\)x.*/\1/')"
223 VERIZ_RES2="$(echo $FRAMEBUFFER | sed 's/ Mode 0x.*x\(.*\) (.*/\1/')"
225 if [ -n "$HORIZ_RES1" -a -n "$VERIZ_RES1" -a -n "$HORIZ_RES2" ] ; then
226 if [ $(echo $VERIZ_RES1 - $VERIZ_RES2 | bc -l) -eq 0 ] ; then
227 VERIZ_RESULT="$VERIZ_RES1"
228 elif [ "$VERIZ_RES1" -gt "$VERIZ_RES2" ] ; then
229 VERIZ_RESULT="$VERIZ_RES1"
231 VERIZ_RESULT="$VERIZ_RES2"
234 HORIZ_RESULT=$(echo $HORIZ_RES1 + $HORIZ_RES2 | bc -l)
236 # important: keep newline for appropriate placing below $MODES!
237 if [ -n "$HORIZ_RESULT" ] ; then
239 Virtual $HORIZ_RESULT $VERIZ_RES1"
245 if [[ -n $NODDC ]] ; then
246 MODES="Modes \"1024x768\" \"800x600\" \"640x480\" \"1600x1200\" \"1280x1024\" \"1280x960\"$VIRTUAL"
247 elif [[ "$modes" == "\"1024x768\" " || -z $modes ]] ; then
248 MODES="# Modes \"1024x768\" \"800x600\" \"640x480\" \"1600x1200\" \"1280x1024\" \"1280x960\"$VIRTUAL"
250 MODES="# Modes $modes$VIRTUAL"
255 # sync - get hsync/vsync settings {{{
258 [ -r "$MONITORINFO" ] || monitor # get monitor settings
259 vsyncval=$(awk '/Vert. Sync Range:/{print $4}' $MONITORINFO | sed 's/-/.0 - / ; s/$/.0/' | head -1)
260 hsyncval=$(awk '/Hor. Sync Range:/{print $4}' $MONITORINFO | sed 's/-/.0 - / ; s/$/.0/' | head -1)
261 if [ -z $vsyncval ] ; then
262 vsyncval='50.0 - 60.0'
264 if [ -z $hsyncval ] ; then
265 hsyncval='28.0 - 96.0'
273 sudo $HWINFO --mouse > $MOUSEINFO
275 # SynPS/2 Synaptics TouchPad
276 if grep -q 'Device:.*Synaptics' "$MOUSEINFO" ; then
277 if [[ "$SYNAPTICS" == "yes" ]] ; then # check for '-nosynaptics'-option
278 MOUSEDRIVER='synaptics'
279 SYNMOUSE='InputDevice "Synaptics" "AlwaysCore"'
281 Section \"InputDevice\"
283 Identifier \"Synaptics\"
284 Option \"Device\" \"/dev/psaux\"
285 Option \"Protocol\" \"auto-dev\"
286 Option \"LeftEdge\" \"1700\"
287 Option \"RightEdge\" \"5300\"
288 Option \"TopEdge\" \"1700\"
289 Option \"BottomEdge\" \"4200\"
290 Option \"FingerLow\" \"25\"
291 Option \"FingerHigh\" \"30\"
292 Option \"ZAxisMapping\" \"4 5\"
293 Option \"MaxTapTime\" \"180\"
294 Option \"MaxTapMove\" \"220\"
295 Option \"VertScrollDelta\" \"100\"
296 Option \"MinSpeed\" \"0.06\"
297 Option \"MaxSpeed\" \"0.12\"
298 Option \"AccelFactor\" \"0.0010\"
299 # Option \"SHMConfig\" \"on\"
300 # Option \"Repeater\" \"/dev/ps2mouse\"
306 SYNMOUSE='# No synaptics touchpad detected.'
310 # AlpsPS/2 ALPS TouchPad (with Synapticsdriver)
311 if grep -q 'Device:.*ALPS' "$MOUSEINFO" ; then
312 if [[ "$SYNAPTICS" == "yes" ]] ; then # check for '-nosynaptics'-option
313 MOUSEDRIVER='synaptics'
314 SYNMOUSE='InputDevice "Synaptics" "AlwaysCore"'
316 Section \"InputDevice\"
318 Identifier \"Synaptics\"
319 Option \"Device\" \"/dev/psaux\"
320 Option \"Protocol\" \"auto-dev\"
321 Option \"LeftEdge\" \"120\"
322 Option \"RightEdge\" \"850\"
323 Option \"TopEdge\" \"120\"
324 Option \"BottomEdge\" \"650\"
325 Option \"FingerLow\" \"14\"
326 Option \"FingerHigh\" \"15\"
327 Option \"ZAxisMapping\" \"4 5\"
328 Option \"MaxTapTime\" \"180\"
329 Option \"MaxTapMove\" \"50\"
330 Option \"MaxDoubleTapTime\" \"100\"
331 Option \"VertScrollDelta\" \"20\"
332 Option \"HorizScrollDelta\" \"20\"
333 Option \"MinSpeed\" \"0.3\"
334 Option \"MaxSpeed\" \"2.00\"
335 Option \"AccelFactor\" \"0.030\"
336 Option \"UpDownScrolling\" \"1\"
337 Option \"EmulateMiddleButtonTime\" \"75\"
338 Option \"CircularScrolling\" \"1\"
339 Option \"CircScrollDelta\" \"0.1\"
340 Option \"CircScrollTrigger\" \"8\"
341 # Option \"SHMConfig\" \"on\"
342 # Option \"Repeater\" \"/dev/ps2mouse\"
348 SYNMOUSE='# No alps touchpad detected.'
351 SYNMOUSE='# No synaptics/alps touchpad present.'
355 # USB-PS/2 Optical Mouse
356 if [ -n "$USE_USB" ] ; then
357 USBMOUSE='InputDevice "USB Mouse" "CorePointer"'
359 Section \"InputDevice\"
360 Identifier \"USB Mouse\"
362 Option \"Device\" \"/dev/input/mice\"
363 Option \"Protocol\" \"auto\"
364 Option \"ZAxisMapping\" \"4 5\"
365 Option \"Buttons\" \"5\"
366 Option \"SendCoreEvents\" \"true\"
370 USBMOUSE='# InputDevice "USB Mouse" "CorePointer"'
374 if grep -q 'Device:.*Serial' "$MOUSEINFO" ; then
376 SERMOUSE='InputDevice "Serial Mouse" "CorePointer"'
378 Section \"InputDevice\"
379 Identifier \"Serial Mouse\"
381 Option \"Device\" \"/dev/ttyS0\"
382 Option \"Protocol\" \"Microsoft\"
383 Option \"Emulate3Buttons\" \"true\"
384 Option \"Emulate3Timeout\" \"70\"
385 Option \"SendCoreEvents\" \"true\"
389 SERMOUSE='# No serial mouse detected.'
393 # ImExPS/2 Logitech Explorer Mouse
394 # "PS2++ Logitech MX Mouse"
395 if [ -n "$USE_PS2" ] ; then
397 PS2MOUSE='InputDevice "PS/2 Mouse" "CorePointer"'
399 Section \"InputDevice\"
400 Identifier \"PS/2 Mouse\"
402 Option \"Device\" \"/dev/input/mice\"
403 # Option \"Device\" \"/dev/psaux\"
404 Option \"Protocol\" \"PS/2\"
405 Option \"Emulate3Buttons\" \"true\"
406 Option \"Emulate3Timeout\" \"70\"
407 Option \"SendCoreEvents\" \"true\"
411 PS2MOUSE='# InputDevice "PS/2 Mouse" "CorePointer"'
416 # Section \"InputDevice\"
417 # Identifier \"Generic Mouse\"
419 # Option \"Device\" \"/dev/input/mice\"
420 # Option \"Protocol\" \"auto\"
421 # Option \"ZAxisMapping\" \"4 5\"
422 # Option \"Buttons\" \"5\"
423 # Option \"SendCoreEvents\" \"true\"
434 # commandline parsing {{{
437 zparseopts -K -- module:=o_module help=o_help noddc=o_noddc nosync=o_nosync \
438 vsync:=o_vsync hsync:=o_hsync mode:=o_mode force=o_force display:=o_display \
439 nostart=o_nostart nodpms=o_nodpms nosynaptics=o_nosynaptics nousb=o_nousb \
440 nops2=o_nops2 genmouse=o_genmouse novref=o_novref nohsync=o_nohsync \
441 fallback=o_fallback usb=o_usb ps2=o_ps2 composite=o_composite \
444 if [[ $# == 0 || "$o_help" != "" || "$1" == '-h' || "$1" == '--help' ]]; then
448 if [[ "$o_force" != "" ]]; then
452 if [[ "$o_fallback" != "" ]]; then
454 if [ -r /etc/X11/xorg.conf.example ] ; then
455 sudo cp /etc/X11/xorg.conf.example $XCONFIG
456 print "$bold_color$fg[blue]Copying /etc/X11/xorg.conf.example to $XCONFIG as requested via fallback option."
458 echo 'Error: /etc/X11/xorg.conf.example not readable, exiting.'
463 if [[ "$o_nodpms" != "" ]]; then
464 DPMS='Option "DPMS" "false"'
466 DPMS='Option "DPMS" "true"'
469 if [[ "$o_noddc" != "" ]]; then
473 if [[ "$o_vsync" != "" ]]; then
477 if [[ "$o_hsync" != "" ]]; then
481 if [[ "$o_nousb" != "" ]]; then
482 echo 'Warning: option -nousb is deprecated.'>&2
485 if [[ "$o_usb" != "" ]]; then
489 if [[ "$o_nops2" != "" ]]; then
490 echo 'Warning: optino -nops2 is deprecatedË™'>&2
493 if [[ "$o_ps2" != "" ]]; then
497 if [[ "$o_genmouse" != "" ]]; then
501 if [[ "$o_nosynaptics" != "" ]]; then
507 if [[ "$o_nostart" != "" ]]; then
511 DISPLAY=$o_display[2]
513 eval WINDOWMANAGER=\${$#}
515 if [[ "$XKEYBOARD" == de ]] ; then
517 # Option \"XkbVariant\" \"nodeadkeys\""
520 if [ -n "$FORCE" -o ! -r "$XCONFIG" -a -z "$FALLBACK" ] ; then
521 print -n "$bold_color$fg[blue]Gathering hardware information...$fg[red]"
523 sync # get hsync/vsync
525 if [ -z "$o_hsync" ] ; then
526 o_hsync=(-hsync "$hsyncval")
528 HORIZSYNC=" HorizSync $HSYNC"
530 o_hsync=(-hsync "$o_hsync[2]")
532 HORIZSYNC=" HorizSync $HSYNC"
535 if [ -z "$o_vsync" ] ; then
536 o_vsync=(-vsync "$vsyncval")
538 VERTISYNC=" VertRefresh $VSYNC"
540 o_vsync=(-vsync "$o_vsync[2]")
542 VERTISYNC=" VertRefresh $VSYNC"
545 if [[ "$o_nosync" != "" ]]; then
546 HORIZSYNC="# HorizSync 28.0 - 96.0 # deactivated via -nosync option of grml-x"
547 VERTISYNC="# VertRefresh 50.0 - 60.0 # deactivated via -nosync option of grml-x"
550 if [[ "$o_nohsync" != "" ]]; then
551 HORIZSYNC="# HorizSync 28.0 - 96.0 # deactivated via -nohsync option of grml-x"
554 if [[ "$o_novref" != "" ]]; then
555 VERTISYNC="# VertRefresh 50.0 - 60.0 # deactivated via -novref option of grml-x"
558 if [[ "$o_xinerama" != "" ]]; then
562 if [[ "$o_composite" != "" ]]; then
563 COMPOSITE="Section \"Extensions\"
564 Option \"Composite\" \"Enable\"
567 COMPOSITE="#Section \"Extensions\"
568 # Option \"Composite\" \"Enable\"
576 MONITOR=$(awk '/monitor.1:/{print $3}' $HWINFO_TMP)
577 [[ $MONITOR != 'ddc' ]] && NODDC=yes
581 if [ -z "$MODULE" ] ; then
582 MODULE="$(getBootParam xmodule 2>/dev/null)"
583 if [ -z "$MODULE" ] ; then
584 MODULE=$(grep 'XFree86 v4 Server Module:' "${HWINFO_TMP}" | head -1 | awk '{print $5}')
585 if [ -z "$MODULE" ] ; then
588 # hwinfo >=13.28 reports driver 'intel' instead of i810
589 if [[ "$MODULE" == 'intel' ]] ; then
590 [ -r /usr/lib/xorg/modules/drivers/intel_drv.so ] || MODULE='i810'
597 mouse # get mouse settings
598 VGA=$(lspci | grep VGA | sed 's/.*compatible controller: //' | head -1)
601 if [ -z $MODE ] ; then
602 B_MODE="$(getBootParam xmode 2>/dev/null)"
603 if [ -n "$B_MODE" ] ; then
604 MODES="Modes \"$B_MODE\""
607 if [ -z "$MODES" ] ; then
608 mode # get available modes
611 MODES="Modes \"$MODE\""
615 print "$fg[green]done$reset_color"
616 print "$bg[black]$fg[white]$bold_color"
617 print "$fg[green]Specified windowmanager is $fg[yellow]$WINDOWMANAGER"
618 print "$fg[green]Video is $fg[yellow]$VGA$fg[green] using $bg[black]$fg[yellow]${XSERVER}$fg[cyan](${MODULE})$fg[green] Server"
619 [[ -z $HSYNC ]] && [[ -z $VSYNC ]] && print "$fg[green]Monitor is $fg[yellow]$MONITOR"
620 [[ -z $HSYNC ]] && [[ -n $VSYNC ]] && print "$fg[green]Monitor is $fg[yellow]$MONITOR$fg[green], VSYNC: $fg[yellow]$VSYNC"
621 [[ -z $VSYNC ]] && [[ -n $HSYNC ]] && print "$fg[green]Monitor is $fg[yellow]$MONITOR$fg[green], HSYNC: $fg[yellow]$HSYNC"
622 [[ -n $VSYNC ]] && [[ -n $HSYNC ]] && print "$fg[green]Monitor is $fg[yellow]$MONITOR$fg[green], HSYNC: $fg[yellow]$HSYNC $fg[green]VSYNC: $fg[yellow]$VSYNC"
623 [[ -n $modes ]] && print "$fg[green]Using default X.org modes."
624 [[ -z $modes ]] && print "$fg[green]Using Mode: $fg[yellow]$MODE"
625 print "${reset_color}"
631 # check for requirements {{{
634 if ! [ -x $(which hwinfo) ] ; then
635 print "$bg[black]$fg[red]${bold_color}Error: hwinfo not found in path.${reset_color}
636 Note: run 'apt-get install hwinfo' on systems running debian.
637 Exiting.${reset_color}"
641 if ! [[ -d /sys ]] ; then
642 print "$bg[black]$fg[red]${bold_color}Error: mounted /sys required (for hwinfo).${reset_color}
643 You may want to add the following line to your /etc/fstab:
645 sysfs /sys sysfs defaults 0 0
647 or just run 'mount /sys'. Exiting.${reset_color}"
657 ################################################################################
659 # Purpose: config file for xserver - generated by grml-x
660 # Bug-Reports: see http://grml.org/bugs/
661 # Latest change: ${DATE}
663 # /usr/share/doc/xserver-xorg/ and
664 # http://wiki.x.org/wiki/Home and
665 # http://ftp.x.org/pub/X11R7.0/doc/html/index.html for information on Xorg
666 # Refer to the xorg.conf man page and to
667 # http://ftp.x.org/pub/X11R7.0/doc/html/xorg.conf.5.html
668 # for details about the format of this file.
670 # If you would like this file to be automatically reconfigured by debian,
671 # run the following command:
672 # sudo dpkg-reconfigure -phigh xserver-xorg
673 ################################################################################
675 Section "ServerLayout"
676 Identifier "XServer Configured"
677 Screen 0 "Screen0" 0 0
678 # InputDevice "Keyboard0" "CoreKeyboard"
679 # InputDevice "Generic Mouse" "CorePointer"
683 Section "ServerFlags"
684 Option "AllowMouseOpenFail" "true" # allows the server to start up even if the mouse does not work
685 Option "DontVTSwitch" "false" # allow switching between virtual terminal
686 # Option "DontZap" "true" # disable <Crtl><Alt><BS> (server abort)
687 # Option "DontZoom" "true" # disable <Crtl><Alt><KP_+>/<KP_-> (resolution switching)
691 # More information: http://ftp.x.org/pub/X11R7.0/doc/html/fonts.html
693 # FontPath "/usr/share/fonts/ttf/western"
694 # FontPath "/usr/share/fonts/ttf/decoratives"
695 FontPath "/usr/share/fonts/truetype/ttf-bitstream-vera"
696 FontPath "/usr/share/fonts/latex-ttf-fonts"
697 FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
700 # Modules - see /usr/X11R6/lib/modules/fonts and /usr/X11R6/lib/modules/extensions
702 Load "dbe" # double buffer extension
703 Load "dri" # direct rendering
704 Load "glx" # 3D layer / GLX extension
705 Load "type1" # type1 font module
706 Load "freetype" # freetype fonts rendering
707 Load "extmod" # some commonly used server extensions (e.g. shape extension)
708 Load "record" # recording extension
709 Load "evdev" # generic input handling driver on Linux
710 # Load "vbe" # Vesa BIOS Extension
711 # Load "i2c" # I2C bus
712 # Load "int10" # initialize graphics cards via int10 call to the BIOS
713 # Load "v4l" # Video for Linux
714 ## Deprecated/unneeded modules with Xorg >=7.0:
715 # Load "speedo" # font module (does not exist anymore)
716 # Load "ddc" # ddc probing of monitor (automatically loaded)
717 # Load "GLcore" # render OpenGL in software (automatically loaded)
718 # Load "bitmap" # bitmap fonts (automatically loaded)
719 # Valid entries - see /usr/lib/xorg/modules/[extensions/]
720 # afb bitmap cfb cfb16 cfb24 cfb32 cw damage dbe ddc dri drm extmod fb
721 # fbdevhw freetype GLcore glx i2c int10 int10 layer mfb pcidata rac ramdac
722 # record scanpci shadow shadowfb type1 vbe vgahw xaa xf1bpp xf24_32bpp xf4bpp
723 # xf8_16bpp xf8_32bpp xtrap
726 # If you'd like to switch the positions of your capslock and control keys, use:
727 # Option "XkbOptions" "ctrl:swapcaps"
728 # Or if you just want both to be control, use:
729 # Option "XkbOptions" "ctrl:nocaps"
730 # More information: http://ftp.x.org/pub/X11R7.0/doc/html/XKB-Config.html
731 # Section "InputDevice"
732 # Identifier "Keyboard0"
733 # Option "CoreKeyboard"
735 # # Option "XkbOptions" "ctrl:swapcaps,grp:alt_shift_toggle,grp_led:scroll,compose:menu"
738 # More information: http://ftp.x.org/pub/X11R7.0/doc/html/mouse.html
739 ${USBMOUSEDETAIL}${PS2MOUSEDETAIL}${SERMOUSEDETAIL}${SYNMOUSEDETAIL}${EVDEV_MOUSE}
741 Identifier "Monitor0"
742 # ModelName "Old Monitor (no DDC)"
744 # HorizSync 28.0 - 78.0 # Warning: This may fry very old Monitors
745 # HorizSync 28.0 - 96.0 # Warning: This may fry old Monitors
747 # VertRefresh 50.0 - 76.0 # Very conservative. May flicker.
748 # VertRefresh 50.0 - 60.0 # Extreme conservative. Will flicker. TFT default.
750 # Need more information?
751 # http://xtiming.sourceforge.net/cgi-bin/xtiming.pl
752 # http://en.tldp.org/HOWTO/XFree86-Video-Timings-HOWTO/
756 ### Available Driver options are:
757 ## sw_cursor is needed for some ati and radeon cards
766 # Option "RenderAccel" "true"
767 # Option "AllowGLXWithComposite" "true"
769 # The following line is auto-generated by grml-x
773 ## Workaround for drivers (for example radeon) which might send output to wrong device:
774 # Option "MonitorLayout" "LVDS, AUTO"
775 # Option "MonitorLayout" "LVDS, CRT"
776 # Option "MonitorLayout" "NONE, STV"
777 # Option "MonitorLayout" "LVDS"
817 # Make sure you have the relevant Debian packages on your system
818 # to be able to use DRI (libgl1-mesa-dri for example)
825 ## END OF FILE #################################################################
832 XCONFTMP="/tmp/xconfig.$$"
834 # we do not want to have two CorePointers, deactivate one therefore
835 if grep -Eq '^[[:space:]]+InputDevice[ ]+"USB Mouse"[ ]+"CorePointer"' $XCONFTMP ; then
836 if grep -Eq '^[[:space:]]+InputDevice[ ]+"PS/2 Mouse"[ ]+"CorePointer"' $XCONFTMP ; then
837 sed -i 's|InputDevice.*PS/2.*CorePointer|# & # deactivated to avoid two CorePointers|' $XCONFTMP
840 [ -f $XCONFIG ] && sudo mv -f $XCONFIG $XCONFIG.old
841 sudo mv $XCONFTMP $XCONFIG
842 sudo chown root.root $XCONFIG
843 sudo chmod 644 $XCONFIG
850 if [[ ! -f $XCONFIG ]] ; then
851 print -n "$bold_color$fg[blue]Creating $XCONFIG: $fg[red]"
852 writeit && print "$fg[green]done$reset_color"
854 if [ -z "$FORCE" -a -z "$FALLBACK" ] ; then
855 print "$bold_color$fg[blue]Notice: $XCONFIG exists already.
856 Use the force-option (-force) to force creation.
860 if [[ -n "$FORCE" ]] ; then
861 print "$bold_color$fg[blue]Force-switch or manual option(s) detected:"
862 print -n "\-> Moving eventual existing $XCONFIG to ${XCONFIG}.old: $fg[red]"
863 writeit && print "$fg[green]done$reset_color"
872 if [ -z "$NOSTART" ] ; then
874 if [ -x /etc/init.d/xorg-common ] ; then
875 sudo /etc/init.d/xorg-common start
877 if [ -x /etc/init.d/xfree86-common ] ; then
878 sudo /etc/init.d/xfree86-common start
882 if [ -z "$DISPLAY" ] ; then
883 print "$bold_color$fg[green]Now trying to run startx.$reset_color"
884 startx $XINITRC -- $XOPTS
886 print "$bold_color$fg[green]Now trying to run startx on display $DISPLAY.$reset_color"
887 startx $XINITRC -- :$DISPLAY $XOPTS
890 print "$bold_color$fg[blue]Not running startx as requested via option.$reset_color"
900 if [ -z "$ROOT" ] ; then
901 if [[ $(tty) == /dev/pts/* ]] ; then
902 print "It seems you are running $PROGRAMNAME from inside GNU screen.
903 Notice that this might fail if running as user grml!
904 Please exit screen and try to run $PROGRAMNAME again."
907 print "Run the following commands for getting information on your hardware:
909 discover -v --data-path=xfree86/server/device/driver display
910 xdebconfigurator -c -d -i -x
911 get-edid | parse-edid
913 Do you want to go the debian way of life? Run:
914 apt-get install x-window-system-core read-edid mdetect hwinfo xdebconfigurator
915 dpkg-reconfigure x-window-system-core (or xserver-xorg depending on your system)
917 Problems with the module used for X? Try to load another one or
918 fall back to module vesa:
919 $PROGRAMNAME -module radeon ...
920 $PROGRAMNAME -module vesa ...
922 Do you want to deactivate a present synaptics touchpad? Run:
923 $PROGRAMNAME -nosynaptics ...
925 Your monitor is very old and/or does not support DDC-probing?
926 $PROGRAMNAME -noddc ...
928 Do you want to create a x configuration file but do not start X?
929 $PROGRAMNAME -nostart ...
931 Monitor frequency too high or too low? Just specify hsync/vsync manually:
932 $PROGRAMNAME -hsync 30-65 ...
933 $PROGRAMNAME -hsync 30-65 -vsync 50-60 ...
935 Want to adjust the resolution? Use the mode-switch:
936 $PROGRAMNAME -mode 1024x768 ...
937 $PROGRAMNAME -mode '1280x1024 1024x768' ...
939 Problems? Use vesa with resolution 1024x768:
940 $PROGRAMNAME -module vesa -mode 1024x768 ...
942 Still problems with X? Use the fallback option:
943 $PROGRAMNAME -fallback ...
945 To adjust resolution while running X execute:
948 More information on grml-x can be found in the manual page: man grml-x
950 Report bugs, send wishes and feedback to the grml team:
951 http://grml.org/bugs/ - contact (at) grml.org
953 print -n "$reset_color"
969 if ! [ -x "$(which $WINDOWMANAGER)" ] ; then
970 print "$bg[black]$fg[red]${bold_color}Fatal: windowmanager $fg[blue]$WINDOWMANAGER$fg[red] not executable, startx won' work.${reset_color}">&2
973 if [ -w "$XINITRC" ] ; then
974 sed -i "s|^[^#]*exec.*| exec $WINDOWMANAGER|g" $XINITRC
977 echo -e "#!/bin/sh\n exec $WINDOWMANAGER" >> $XINITRC
982 ## END OF FILE #################################################################
983 # vim:foldmethod=marker expandtab ai ft=zsh