slackware-current/source/x/x11-skel/scripts/xwmconfig

231 lines
7.5 KiB
Text
Raw Normal View History

#!/bin/sh
# Copyright 1999, 2002, 2012 Patrick Volkerding, Moorhead, Minnesota USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# First, let's bail if our being here doesn't make sense:
if [ ! -d /etc/X11/xinit ]; then
exit
fi
if [ "`cd /etc/X11/xinit ; echo *.*`" = '*.*' ]; then
exit
fi
if [ "$USER" = "root" ]; then
TMP=/var/log/setup/tmp
else
TMP=$HOME/.xwmconfig
fi
if [ ! -d $TMP ]; then
mkdir -p $TMP
chmod 700 $TMP
fi
# Do we already have an existing default?
unset PRESELECT
if [ -L /etc/X11/xinit/xinitrc ]; then
CURRENT="`/bin/ls -l /etc/X11/xinit/xinitrc | cut -f 2 -d '>' | cut -b2-`"
PRESELECT=" --default-item $CURRENT "
fi
# Figure out who we are and set up some background information:
if [ "$USER" = "root" ]; then
BACKTITLE="--backtitle \"Setting system-wide default window manager in /etc/X11/xinit/\""
else
BACKTITLE="--backtitle \"Setting default window manager in $HOME/.xinitrc and $HOME/.xsession\""
fi
# This stops --backtitle from cluttering the initial install:
if [ ! -r /proc/kcore ]; then
BACKTITLE=""
fi
# Remove any previous script:
rm -f $TMP/tmpscript.sh
# Add the top of the script:
if [ -r /etc/X11/xinit/xinitrc.gnome -a -r /etc/X11/xinit/xinitrc.kde ]; then
cat << EOF > $TMP/tmpscript.sh
#!/bin/sh
dialog $BACKTITLE --title "SELECT DEFAULT WINDOW MANAGER FOR X" $PRESELECT --menu \\
"Please select the default window manager to use with the X Window \\
System. This will define the style of graphical user interface \\
the computer uses. KDE and GNOME provide the most features. People \\
with Windows or MacOS experience will find either one easy to use. \\
Other window managers are easier on system \\
resources, or provide other unique features." 12 74 0 \\
EOF
elif [ -r /etc/X11/xinit/xinitrc.kde ]; then
cat << EOF > $TMP/tmpscript.sh
#!/bin/sh
dialog $BACKTITLE --title "SELECT DEFAULT WINDOW MANAGER FOR X" $PRESELECT --menu \\
"Please select the default window manager to use with the X Window \\
System. This will define the style of graphical user interface \\
the computer uses. KDE provides the most features, and people \\
with Windows or MacOS experience will find it easy to use. \\
Other window managers are easier on system \\
resources, or provide other unique features." 12 74 0 \\
EOF
elif [ -r /etc/X11/xinit/xinitrc.xfce ]; then
cat << EOF > $TMP/tmpscript.sh
#!/bin/sh
dialog $BACKTITLE --title "SELECT DEFAULT WINDOW MANAGER FOR X" $PRESELECT --menu \\
"Please select the default window manager to use with the X Window \\
System. This will define the style of graphical user interface \\
the computer uses. XFce provides the most features, and people \\
with Windows or MacOS experience will find it easy to use. \\
Other window managers are easier on system \\
resources, or provide other unique features." 12 74 0 \\
EOF
else
cat << EOF > $TMP/tmpscript.sh
dialog $BACKTITLE --title "SELECT DEFAULT WINDOW MANAGER FOR X" $PRESELECT --menu \\
"Please select the default window manager to use with the X Window \\
System. This will define the style of graphical user interface \\
the computer uses." 12 74 0 \\
EOF
fi
# Add KDE as the first and default entry:
if [ -r /etc/X11/xinit/xinitrc.kde ]; then
Sat Oct 31 01:29:37 UTC 2020 a/aaa_elflibs-15.0-x86_64-27.txz: Rebuilt. More temporary additions: libicudata.so.67.1, libicui18n.so.67.1, libicuio.so.67.1, libicutest.so.67.1, libicutu.so.67.1, libicuuc.so.67.1. a/xfsprogs-5.9.0-x86_64-2.txz: Rebuilt. Recompiled against icu4c-68.1. ap/sqlite-3.33.0-x86_64-2.txz: Rebuilt. Recompiled against icu4c-68.1. ap/tmux-3.1c-x86_64-1.txz: Upgraded. d/git-2.29.2-x86_64-1.txz: Upgraded. d/meson-0.56.0-x86_64-1.txz: Upgraded. l/boost-1.74.0-x86_64-3.txz: Rebuilt. Recompiled against icu4c-68.1. l/harfbuzz-2.7.2-x86_64-2.txz: Rebuilt. Recompiled against icu4c-68.1. l/icu4c-68.1-x86_64-1.txz: Upgraded. Shared library .so-version bump. l/libical-3.0.8-x86_64-3.txz: Rebuilt. Recompiled against icu4c-68.1. l/libvisio-0.1.7-x86_64-4.txz: Rebuilt. Recompiled against icu4c-68.1. l/qt-4.8.7-x86_64-17.txz: Rebuilt. Recompiled against icu4c-68.1. l/qt5-5.15.1-x86_64-3.txz: Rebuilt. Recompiled against icu4c-68.1. l/qt5-webkit-5.212.0_alpha4-x86_64-4.txz: Rebuilt. Recompiled against icu4c-68.1. l/raptor2-2.0.15-x86_64-10.txz: Rebuilt. Recompiled against icu4c-68.1. l/vte-0.60.3-x86_64-2.txz: Rebuilt. Recompiled against icu4c-68.1. n/dovecot-2.3.11.3-x86_64-2.txz: Rebuilt. Recompiled against icu4c-68.1. n/ipset-7.7-x86_64-1.txz: Upgraded. n/php-7.4.12-x86_64-2.txz: Rebuilt. Recompiled against icu4c-68.1. n/postfix-3.5.7-x86_64-3.txz: Rebuilt. Recompiled against icu4c-68.1. n/samba-4.13.1-x86_64-2.txz: Rebuilt. Recompiled against icu4c-68.1. n/tin-2.4.4-x86_64-3.txz: Rebuilt. Recompiled against icu4c-68.1. t/texlive-2020.200608-x86_64-2.txz: Rebuilt. Recompiled against icu4c-68.1. x/x11-skel-7.7-x86_64-5.txz: Rebuilt. xwmconfig: change blurb from "K Desktop Environment" to "KDE Plasma Desktop". extra/brltty/brltty-6.1-x86_64-3.txz: Rebuilt. Recompiled against icu4c-68.1. extra/pure-alsa-system/qt5-5.15.1-x86_64-3_alsa.txz: Rebuilt. Recompiled against icu4c-68.1. isolinux/initrd.img: Rebuilt. Added libnsl.so.2. Thanks to Olek. usb-and-pxe-installers/usbboot.img: Rebuilt. Added libnsl.so.2. Thanks to Olek.
2020-10-31 02:29:37 +01:00
echo "\"xinitrc.kde\" \"KDE: KDE Plasma Desktop\" \\" >> $TMP/tmpscript.sh
fi
# Then, we add GNOME:
if [ -r /etc/X11/xinit/xinitrc.gnome ]; then
echo "\"xinitrc.gnome\" \"GNU Network Object Model Environment\" \\" >> $TMP/tmpscript.sh
fi
# Add XFce:
if [ -r /etc/X11/xinit/xinitrc.xfce ]; then
echo "\"xinitrc.xfce\" \"The Cholesterol Free Desktop Environment\" \\" >> $TMP/tmpscript.sh
fi
# Add Enlightenment:
if [ -r /etc/X11/xinit/xinitrc.e ]; then
echo "\"xinitrc.e\" \"Enlightenment\" \\" >> $TMP/tmpscript.sh
fi
# Add Fluxbox:
if [ -r /etc/X11/xinit/xinitrc.fluxbox ]; then
echo "\"xinitrc.fluxbox\" \"The fluxbox window manager\" \\" >> $TMP/tmpscript.sh
fi
# Add Blackbox:
if [ -r /etc/X11/xinit/xinitrc.blackbox ]; then
echo "\"xinitrc.blackbox\" \"The blackbox window manager\" \\" >> $TMP/tmpscript.sh
fi
# Add WindowMaker:
if [ -r /etc/X11/xinit/xinitrc.wmaker ]; then
echo "\"xinitrc.wmaker\" \"WindowMaker\" \\" >> $TMP/tmpscript.sh
fi
# Add FVWM2:
if [ -r /etc/X11/xinit/xinitrc.fvwm2 ]; then
echo "\"xinitrc.fvwm2\" \"F(?) Virtual Window Manager (version 2.xx)\" \\" >> $TMP/tmpscript.sh
fi
# Add FVWM95:
if [ -r /etc/X11/xinit/xinitrc.fvwm95 ]; then
echo "\"xinitrc.fvwm95\" \"FVWM2 with a Windows look and feel\" \\" >> $TMP/tmpscript.sh
fi
# Add icewm:
if [ -r /etc/X11/xinit/xinitrc.icewm ]; then
echo "\"xinitrc.icewm\" \"ICE Window Manager\" \\" >> $TMP/tmpscript.sh
fi
# Add sawfish:
if [ -r /etc/X11/xinit/xinitrc.sawfish ]; then
echo "\"xinitrc.sawfish\" \"Sawfish without GNOME\" \\" >> $TMP/tmpscript.sh
fi
# Add twm:
if [ -r /etc/X11/xinit/xinitrc.twm ]; then
echo "\"xinitrc.twm\" \"Tab Window Manager (very basic)\" \\" >> $TMP/tmpscript.sh
fi
# Add mwm:
if [ -r /etc/X11/xinit/xinitrc.mwm ]; then
echo "\"xinitrc.mwm\" \"Motif WM\" \\" >> $TMP/tmpscript.sh
fi
# Now, add support for the other window managers:
( cd /etc/X11/xinit
for file in xinitrc.* ; do
if [ ! "$file" = "xinitrc.kde" -a ! "$file" = "xinitrc.gnome" \
-a ! "$file" = "xinitrc.e" -a ! "$file" = "xinitrc.wmaker" \
-a ! "$file" = "xinitrc.fvwm2" -a ! "$file" = "xinitrc.fvwm95" \
-a ! "$file" = "xinitrc.icewm" -a ! "$file" = "xinitrc.twm" \
-a ! "$file" = "xinitrc.mwm" -a ! "$file" = "xinitrc.xfce" \
-a ! "$file" = "xinitrc.blackbox" -a ! "$file" = "xinitrc.fluxbox" \
-a ! "$file" = "xinitrc.sawfish" ]; then
echo "\"$file\" \"$file\" \\" >> $TMP/tmpscript.sh
fi
done
)
# Then, the tail end:
cat << EOF >> $TMP/tmpscript.sh
2> $TMP/output
if [ ! \$? = 0 ]; then
rm -f $TMP/output
echo "Canceled."
exit
fi
EOF
sh $TMP/tmpscript.sh
if [ ! -r $TMP/output ]; then
rm -f $TMP/tmpscript.sh
exit
fi
OUTPUT=`cat $TMP/output`
# If xwmconfig is run by root, it changes the system-wide default for users
# that do not have a $HOME/.xinitrc:
if [ "$USER" = "root" ]; then
if [ -r /etc/X11/xinit/$OUTPUT ]; then
( cd /etc/X11/xinit ; rm -f xinitrc ; ln -sf $OUTPUT xinitrc )
fi
fi
# Also set up a new $HOME/.xinitrc and $HOME/.xsession:
if [ -r /etc/X11/xinit/$OUTPUT -a ! "$HOME" = "/" ]; then
if [ -r $HOME/.xinitrc ]; then
rm -f $HOME/.xinitrc-backup
mv $HOME/.xinitrc $HOME/.xinitrc-backup
fi
cat /etc/X11/xinit/$OUTPUT > $HOME/.xinitrc
if [ -r $HOME/.xsession ]; then
rm -f $HOME/.xsession-backup
mv $HOME/.xsession $HOME/.xsession-backup
fi
cat /etc/X11/xinit/$OUTPUT > $HOME/.xsession
chmod 755 $HOME/.xsession
fi
rm -f $TMP/tmpscript.sh $TMP/output