From afd9eb9dd4354e30810859cc8fae0a940ea8301c Mon Sep 17 00:00:00 2001 From: mharris Date: Tue, 1 Nov 2005 02:00:56 +0000 Subject: [PATCH] Add Red Hat specific custom scripts --- Xclients | 65 +++++++++++++++++++++++++++++++++++++++++++ Xmodmap | 25 +++++++++++++++++ Xresources | 13 +++++++++ xinitrc | 32 +++++++++++++++++++++ xinitrc-common | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ xinput.sh | 44 +++++++++++++++++++++++++++++ 6 files changed, 254 insertions(+) create mode 100755 Xclients create mode 100644 Xmodmap create mode 100644 Xresources create mode 100755 xinitrc create mode 100644 xinitrc-common create mode 100644 xinput.sh diff --git a/Xclients b/Xclients new file mode 100755 index 0000000..a4c6e37 --- /dev/null +++ b/Xclients @@ -0,0 +1,65 @@ +#!/bin/bash +# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This +# copyrighted material is made available to anyone wishing to use, modify, +# copy, or redistribute it subject to the terms and conditions of the +# GNU General Public License version 2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +GSESSION="$(which gnome-session 2>/dev/null)" +STARTKDE="$(which startkde 2>/dev/null)" + +# check to see if the user has a preferred desktop +PREFERRED= +if [ -f /etc/sysconfig/desktop ]; then + . /etc/sysconfig/desktop + if [ "$DESKTOP" = "GNOME" ]; then + PREFERRED="$GSESSION" + elif [ "$DESKTOP" = "KDE" ]; then + PREFERRED="$STARTKDE" + fi +fi + +if [ -n "$PREFERRED" ]; then + exec "$PREFERRED" +fi + +# now if we can reach here, either no desktop file was present, +# or the desktop requested is not installed. + +# by default, we run GNOME. +if [ -n "$GSESSION" ]; then + exec "$GSESSION" +fi + +# if GNOME isn't installed, try KDE. +if [ -n "$STARTKDE" ]; then + exec "$STARTKDE" +fi + +# Failsafe. + +# these files are left sitting around by TheNextLevel. +rm -f $HOME/Xrootenv.0 + +# Argh! Nothing good is installed. Fall back to twm +{ + # gosh, neither fvwm95 nor fvwm2 is available; + # fall back to failsafe settings + if [ -x /usr/bin/xclock ] ; then + /usr/bin/xclock -geometry 100x100-5+5 & + elif [ -x /usr/bin/xclock ] ; then + /usr/bin/xclock -geometry 100x100-5+5 & + fi + if [ -x /usr/bin/xterm ] ; then + /usr/bin/xterm -geometry 80x50-50+150 & + fi + if [ -x /usr/bin/firefox -a -f /usr/share/doc/HTML/index.html ]; then + /usr/bin/firefox /usr/share/doc/HTML/index.html & + fi + if [ -x /usr/bin/twm ] ; then + exec /usr/bin/twm + fi +} diff --git a/Xmodmap b/Xmodmap new file mode 100644 index 0000000..5625f3a --- /dev/null +++ b/Xmodmap @@ -0,0 +1,25 @@ +! /etc/X11/Xmodmap +! +! global Xmodmap file -- used by both xdm and xinit (startx) + +! keycode and keysym remapping should generally be used only if the X +! server config file has been configured to disable the XKEYBOARD +! extension + +! i386 and alpha +! keycode 22 = BackSpace +! keycode 107 = Delete + +! powerpc +! keycode 59 = BackSpace +! keycode 125 = Delete + +! sparc +! keycode 50 = BackSpace +! keycode 73 = Delete + +! Euro sign support +! keycode 26 = e E currency +! keycode 54 = c C cent +! keycode 113 = Mode_switch Mode_switch Multi_key + diff --git a/Xresources b/Xresources new file mode 100644 index 0000000..18bc908 --- /dev/null +++ b/Xresources @@ -0,0 +1,13 @@ +! This is the global resources file that is loaded when +! all users log in, as well as for the login screen + +! Fix the Xft dpi to 96; this prevents tiny fonts +! or HUGE fonts depending on the screen size. +Xft.dpi: 96 + +! hintstyle: medium means that (for Postscript fonts) we +! position the stems for maximum constrast and consistency +! but don't force the stems to integral widths. hintnone, +! hintslight, and hintfull are the other possibilities. +Xft.hintstyle: hintmedium +Xft.hinting: true diff --git a/xinitrc b/xinitrc new file mode 100755 index 0000000..ec3ba1d --- /dev/null +++ b/xinitrc @@ -0,0 +1,32 @@ +#!/bin/sh +# Copyright (C) 1999 - 2005 Red Hat, Inc. All rights reserved. This +# copyrighted material is made available to anyone wishing to use, modify, +# copy, or redistribute it subject to the terms and conditions of the +# GNU General Public License version 2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Authors: +# Mike A. Harris + +# Mandatorily source xinitrc-common, which is common code shared between the +# Xsession and xinitrc scripts which has been factored out to avoid duplication +. /etc/X11/xinit/xinitrc-common + +# The user may have their own clients they want to run. If they don't, +# fall back to system defaults. +if [ -f $HOME/.Xclients ]; then + exec $DBUS_LAUNCH $HOME/.Xclients || \ + exec $HOME/.Xclients +elif [ -f /etc/X11/xinit/Xclients ]; then + exec $DBUS_LAUNCH /etc/X11/xinit/Xclients || \ + exec /etc/X11/xinit/Xclients +else + # Failsafe settings. Although we should never get here + # (we provide fallbacks in Xclients as well) it can't hurt. + [ -x /usr/bin/xclock ] && /usr/bin/xclock -geometry 100x100-5+5 & + [ -x /usr/bin/xterm ] && xterm -geometry 80x50-50+150 & + [ -x /usr/bin/twm ] && /usr/bin/twm +fi diff --git a/xinitrc-common b/xinitrc-common new file mode 100644 index 0000000..8cbd37d --- /dev/null +++ b/xinitrc-common @@ -0,0 +1,75 @@ +#!/bin/bash +# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This +# copyrighted material is made available to anyone wishing to use, modify, +# copy, or redistribute it subject to the terms and conditions of the +# GNU General Public License version 2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# xinitrc-common +# +# This is common code shared by both Xsession and xinitrc scripts. Be sure +# to take this into account when fixing bugs or adding new functionality. + +# Set up i18n environment +if [ -r /etc/profile.d/lang.sh ]; then + . /etc/profile.d/lang.sh +fi + +[ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45' + +userresources=$HOME/.Xresources +usermodmap=$HOME/.Xmodmap +userxkbmap=$HOME/.Xkbmap + +sysresources=/etc/X11/Xresources +sysmodmap=/etc/X11/Xmodmap +sysxkbmap=/etc/X11/Xkbmap + +# merge in defaults +[ -r "$sysresources" ] && xrdb -merge "$sysresources" +[ -r "$userresources" ] && xrdb -merge "$userresources" + +# merge in keymaps +if [ -r "$sysxkbmap" ]; then + setxkbmap $(cat "$sysxkbmap") + XKB_IN_USE=yes +fi + +if [ -r "$userxkbmap" ]; then + setxkbmap $(cat "$userxkbmap") + XKB_IN_USE=yes +fi + +# xkb and xmodmap don't play nice together +if [ -z "$XKB_IN_USE" ]; then + [ -r "$sysmodmap" ] && xmodmap "$sysmodmap" + [ -r "$usermodmap" ] && xmodmap "$usermodmap" +fi + +unset XKB_IN_USE + +# run all system xinitrc shell scripts. +for file in /etc/X11/xinit/xinitrc.d/* ; do + if echo $file | grep -q "\.sh$" ; then + . $file + else + echo "warning: $file does not end in .sh extension, ignoring" + fi +done + +# Prefix launch of session with ssh-agent if available and not already running. +SSH_AGENT= +if [ -x /usr/bin/ssh-agent -a -z "$SSH_AGENT_PID" ]; then + if [ "x$TMPDIR" != "x" ]; then + SSH_AGENT="/usr/bin/ssh-agent /bin/env TMPDIR=$TMPDIR" + else + SSH_AGENT="/usr/bin/ssh-agent" + fi +fi + +DBUS_LAUNCH= +[ -x /usr/bin/dbus-launch -a -z "$DBUS_SESSION_BUS_ADDRESS" ] && DBUS_LAUNCH="/usr/bin/dbus-launch --exit-with-session" + diff --git a/xinput.sh b/xinput.sh new file mode 100644 index 0000000..3df1374 --- /dev/null +++ b/xinput.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This +# copyrighted material is made available to anyone wishing to use, modify, +# copy, or redistribute it subject to the terms and conditions of the +# GNU General Public License version 2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# X Input method setup script + +# Load up the user and system locale settings +oldterm=$TERM +unset TERM +if [ -r /etc/profile.d/lang.sh ]; then + . /etc/profile.d/lang.sh +fi +[ -n "$oldterm" ] && export TERM=$oldterm + +tmplang=${LC_CTYPE:-${LANG:-"en_US.UTF-8"}} + +## try to source ~/.xinput.d/ll_CC or /etc/X11/xinit/xinput.d/ll_CC to +## setup the input method for locale (CC is needed for Chinese for example) +# unset env vars to be safe +unset XIM XIM_PROGRAM XIM_ARGS XMODIFIERS GTK_IM_MODULE QT_IM_MODULE +lang_region=$(echo $tmplang | sed -e 's/\..*//') +for f in $HOME/.xinput.d/${lang_region} \ + $HOME/.xinput.d/default \ + /etc/X11/xinit/xinput.d/${lang_region} \ + /etc/X11/xinit/xinput.d/default ; do + [ -r $f ] && source $f && break +done +unset lang_region + +[ -n "$GTK_IM_MODULE" ] && export GTK_IM_MODULE +[ -n "$QT_IM_MODULE" ] && export QT_IM_MODULE + +# setup XMODIFIERS +[ -z "$XMODIFIERS" -a -n "$XIM" ] && XMODIFIERS="@im=$XIM" +[ -n "$XMODIFIERS" ] && export XMODIFIERS + +# execute XIM_PROGRAM +[ -n "$XIM_PROGRAM" ] && which "$XIM_PROGRAM" > /dev/null 2>&1 && LANG="$tmplang" "$XIM_PROGRAM" $XIM_ARGS &