From: Michael Prokop Date: Mon, 15 Feb 2010 13:49:32 +0000 (+0100) Subject: Rework xinitrc handling: modularize the code into ~/.xinitrc.d/ and support configura... X-Git-Tag: v1.1.32^0 X-Git-Url: http://git.grml.org/?p=grml-etc.git;a=commitdiff_plain;h=faf02fe7fbaeb1812f4f3a09fad2b9cde9dc3f1e Rework xinitrc handling: modularize the code into ~/.xinitrc.d/ and support configuration through ~/.config/grml/xinitrc --- diff --git a/debian/changelog b/debian/changelog index 5053553..22ef260 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +grml-etc (1.1.32) unstable; urgency=low + + * Rework xinitrc handling: modularize the code into ~/.xinitrc.d/ + and support configuration through ~/.config/grml/xinitrc. + + -- Michael Prokop Mon, 15 Feb 2010 14:50:23 +0100 + grml-etc (1.1.31) unstable; urgency=low * /etc/skel/.Xmodmap: disable Terminate_Server function [thanks diff --git a/etc/skel/.config/grml/xinitrc b/etc/skel/.config/grml/xinitrc new file mode 100644 index 0000000..d364d3f --- /dev/null +++ b/etc/skel/.config/grml/xinitrc @@ -0,0 +1,15 @@ +# Filename: ~/.config/grml/xinitrc +# Purpose: main configuration file for xinitrc of the Grml live system +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +# export XINIT_GRML_INFO=false +# export XINIT_GRML_KEYBOARD=false +# export XINIT_GRML_STARTUPINFO=false +# export XINIT_GRML_VNC=false +# export XINIT_GRML_WALLPAPER=false +# export XINIT_GRML_XSETTINGS=false + +## END OF FILE ################################################################# diff --git a/etc/skel/.xinitrc b/etc/skel/.xinitrc index e3c7310..1e413ff 100755 --- a/etc/skel/.xinitrc +++ b/etc/skel/.xinitrc @@ -1,82 +1,25 @@ #!/bin/sh -# Filename: .xinitrc -# Purpose: specify details for xserver +# Filename: ~/.xinitrc +# Purpose: main configuration file of X startup # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2. +# License: This file is licensed under the GPL v2 or any later version. ################################################################################ -# is something goes wrong fall back to plain x-terminal-emulator: -# failsafe="x-terminal-emulator -ls -T failsafe -geometry 80x24-0-0" -# trap "exec $failsafe" EXIT 1 2 13 15 +# configuration: by default all scripts from ~/.xinitrc.d are executed, +# but it's possible to configure this through a configuration file +if [ -r "$HOME/.config/${distri}/xinitrc" ] ; then + . "$HOME/.config/${distri}/xinitrc" +elif [ -r "$HOME/.config/grml/xinitrc" ] ; then + . "$HOME/.config/grml/xinitrc" +fi -# set wallpaper -# wmsetbg -t /usr/share/grml/desktop.png & - if [ -x /usr/bin/Esetroot ] ; then - [ -r /usr/share/grml/desktop.jpg ] && Esetroot -scale /usr/share/grml/desktop.jpg & - fi - -# print info text - if [ -x /usr/bin/osd_cat ] ; then - echo "Starting X window system and loading window manager..." | \ - osd_cat -c white -A center -p middle -f "-misc-fixed-medium-r-normal-*-15-150-*-*-c-*-iso8859-15" & - fi - -# add at least one entry to xauth -# xauth add $DISPLAY MIT-MAGIC-COOKIE-1 `mcookie` - -# set default cursor - xsetroot -cursor_name left_ptr - -## set mouse speed behaviour: -# fast: -# xset m 4 2 -# normal: - xset m 2 5 -# slow: -# xset m 1 1 - -# other settings: -# xset m 20/10 4 - -# disable screensaver and dpms: -# xset s off -# xset -dpms - -# xresources - [ -r $HOME/.Xresources ] && xrdb -merge $HOME/.Xresources - -# keybindings - if ! [ -r /etc/sysconfig/keyboard ] ; then - [ -r $HOME/.Xmodmap ] && xmodmap $HOME/.Xmodmap || setxkbmap us - else - . /etc/sysconfig/keyboard - if [ "$XKEYBOARD" = "us" ] ; then - [ -r $HOME/.Xmodmap ] && xmodmap $HOME/.Xmodmap - else - if [ -n "$XKEYMODEL" ] ; then - setxkbmap -model "$XKEYMODEL" -layout "$XKEYBOARD" - else - setxkbmap "$XKEYBOARD" - fi - fi - fi - -# mouse for lefty: -# xmodmap -e "pointer = 3 2 1" -# mouse for right hander: -# xmodmap -e "pointer = 1 2 3" - -# start browser with startpage.html, but only in live-cd mode - [ -r /etc/grml_cd ] && grml-info & - -# if the vnc bootoption sets up the password let's start the vnc server - if [ -e $HOME/.vnc/passwd ]; then - /usr/bin/x11vnc -bg -forever -noxdamage -o $HOME/.vnc/x11vnc.log -rfbauth \ - $HOME/.vnc/passwd -auth $HOME/.Xauthority -display $DISPLAY - fi +# execute all existing scripts +for f in ~/.xinitrc.d/* ; do + "$f" +done # default entry, use e.g. 'grml-x windowmanager' for changing or just adjust manually - exec /usr/bin/x-window-manager +exec /usr/bin/x-window-manager ## END OF FILE ################################################################# diff --git a/etc/skel/.xinitrc.d/grml_info b/etc/skel/.xinitrc.d/grml_info new file mode 100755 index 0000000..7ce9983 --- /dev/null +++ b/etc/skel/.xinitrc.d/grml_info @@ -0,0 +1,15 @@ +#!/bin/sh +# Filename: ~/.xinitrc.d/grml_info +# Purpose: start Grml's information screen +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +if [ "$XINIT_GRML_INFO" = "false" ] ; then + exit 0 +fi + +[ -r /etc/grml_cd ] && grml-info & + +## END OF FILE ################################################################# diff --git a/etc/skel/.xinitrc.d/grml_keyboard b/etc/skel/.xinitrc.d/grml_keyboard new file mode 100755 index 0000000..019c963 --- /dev/null +++ b/etc/skel/.xinitrc.d/grml_keyboard @@ -0,0 +1,28 @@ +#!/bin/sh +# Filename: ~/.xinitrc.d/grml_keyboard +# Purpose: configuration of keyboard layout +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +if [ "$XINIT_GRML_KEYBOARD" = "false" ] ; then + exit 0 +fi + +if ! [ -r /etc/sysconfig/keyboard ] ; then + [ -r $HOME/.Xmodmap ] && xmodmap $HOME/.Xmodmap || setxkbmap us +else + . /etc/sysconfig/keyboard + if [ "$XKEYBOARD" = "us" ] ; then + [ -r $HOME/.Xmodmap ] && xmodmap $HOME/.Xmodmap + else + if [ -n "$XKEYMODEL" ] ; then + setxkbmap -model "$XKEYMODEL" -layout "$XKEYBOARD" + else + setxkbmap "$XKEYBOARD" + fi + fi +fi + +## END OF FILE ################################################################# diff --git a/etc/skel/.xinitrc.d/grml_startupinfo b/etc/skel/.xinitrc.d/grml_startupinfo new file mode 100755 index 0000000..f221cc8 --- /dev/null +++ b/etc/skel/.xinitrc.d/grml_startupinfo @@ -0,0 +1,18 @@ +#!/bin/sh +# Filename: ~/.xinitrc.d/grml_startupinfo +# Purpose: display startup information +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +if [ "$XINIT_GRML_STARTUPINFO" = "false" ] ; then + exit 0 +fi + +if [ -x /usr/bin/osd_cat ] ; then + echo "Starting X window system and loading window manager..." | \ + osd_cat -c white -A center -p middle -f "-misc-fixed-medium-r-normal-*-15-150-*-*-c-*-iso8859-15" & +fi + +## END OF FILE ################################################################# diff --git a/etc/skel/.xinitrc.d/grml_vnc b/etc/skel/.xinitrc.d/grml_vnc new file mode 100755 index 0000000..eff5a40 --- /dev/null +++ b/etc/skel/.xinitrc.d/grml_vnc @@ -0,0 +1,19 @@ +#!/bin/sh +# Filename: ~/.xinitrc.d/grml_vnc +# Purpose: enable vnc if configured via bootoption +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +if [ "$XINIT_GRML_VNC" = "false" ] ; then + exit 0 +fi + +# if the vnc bootoption sets up the password let's start the vnc server +if [ -e $HOME/.vnc/passwd ]; then + /usr/bin/x11vnc -bg -forever -noxdamage -o $HOME/.vnc/x11vnc.log -rfbauth \ + $HOME/.vnc/passwd -auth $HOME/.Xauthority -display $DISPLAY +fi + +## END OF FILE ################################################################# diff --git a/etc/skel/.xinitrc.d/grml_wallpaper b/etc/skel/.xinitrc.d/grml_wallpaper new file mode 100755 index 0000000..1aef89f --- /dev/null +++ b/etc/skel/.xinitrc.d/grml_wallpaper @@ -0,0 +1,19 @@ +#!/bin/sh +# Filename: ~/.xinitrc.d/grml_wallpaper +# Purpose: set wallpaper +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +if [ "$XINIT_GRML_WALLPAPER" = "false" ] ; then + exit 0 +fi + +# set wallpaper +# wmsetbg -t /usr/share/grml/desktop.png & + if [ -x /usr/bin/Esetroot ] ; then + [ -r /usr/share/grml/desktop.jpg ] && Esetroot -scale /usr/share/grml/desktop.jpg & + fi + +## END OF FILE ################################################################# diff --git a/etc/skel/.xinitrc.d/grml_xsettings b/etc/skel/.xinitrc.d/grml_xsettings new file mode 100755 index 0000000..a62ce48 --- /dev/null +++ b/etc/skel/.xinitrc.d/grml_xsettings @@ -0,0 +1,34 @@ +#!/bin/sh +# Filename: ~/.xinitrc.d/grml_xsettings +# Purpose: configuration of X settings +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +if [ "$XINIT_GRML_XSETTINGS" = "false" ] ; then + exit 0 +fi + +# set default cursor + xsetroot -cursor_name left_ptr + +## set mouse speed behaviour: +# fast: +# xset m 4 2 +# normal: + xset m 2 5 +# slow: +# xset m 1 1 + +# other settings: +# xset m 20/10 4 + +# disable screensaver and dpms: +# xset s off +# xset -dpms + +# xresources + [ -r $HOME/.Xresources ] && xrdb -merge $HOME/.Xresources + +## END OF FILE #################################################################