summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlinux/bin/asdf151
-rw-r--r--linux/bin/neo.conf49
-rwxr-xr-xlinux/bin/uiae141
3 files changed, 259 insertions, 82 deletions
diff --git a/linux/bin/asdf b/linux/bin/asdf
index 1eb479a..5c50717 100755
--- a/linux/bin/asdf
+++ b/linux/bin/asdf
@@ -1,71 +1,120 @@
#!/bin/sh
+# Copyright 2008 Bernd Steinhauser <berniyh@exherbo.org>
+# Copyright 2008 Benjamin Kellermann
+# Copyright 2008 Pascal Hauck
+# Copyright 2008 Erik Streb del Toro
+# Distributed under the terms of the GNU General Public License v3
+if [ -f "${NEO_CONFIG}" ]; then
+ . "${NEO_CONFIG}" || die "Failed to source ${NEO_CONFIG}"
+elif [ -f "${HOME}"/.neorc ]; then
+ . "${HOME}"/.neorc || die "Failed to source ${HOME}/neo.conf"
+elif [ -f /etc/neo.conf ]; then
+ . /etc/neo.conf || die "Failed to source /etc/neo.conf"
+else
+ echo "No configuration file found. Using default values, this might fail!"
+fi
-################################################################################
-####################### persönliche Einstellungen ##############################
-################################################################################
-# hier einstellen, welche Variante von Neo geladen werden soll:
-# xkbmap, xmoadmap, xprog, alternative, evdev
-NEO_X_VARIANTE="xkbmap"
-
-# hier angeben, wo sich die Neo-Dateien befinden:
-PFAD="$HOME/neo"
-
-# Ort, wo sich die Konsolen-Belegungen befinden:
-CONSOLE_KEYMAP="$PFAD/neo.map"
-################################################################################
-################################################################################
-################################################################################
+# Default paths
+PATH_XMODMAP=${PATH_XMODMAP:-/usr/bin/xmodmap}
+PATH_SETXKBMAP=${PATH_SETXKBMAP:-/usr/bin/setxkbmap}
+PATH_LOADKEYS=${PATH_LOADKEYS:-/usr/bin/loadkeys}
+PATH_SUDO=${PATH_SUDO:-/usr/bin/sudo}
+PATH_SETLEDS=${PATH_SETLEDS:-/usr/bin/setleds}
+PATH_NUMLOCKX=${PATH_NUMLOCKX:-/usr/bin/numlockx}
+PATH_XSET=${PATH_XSET:-/usr/bin/xset}
+# Default values
+NEO_X_VARIANTE=${NEO_X_VARIANTE:-xkbmap}
+NEO_XKBMAP=${NEO_XKBMAP:-de}
+NEO_XKBVARIANT=${NEO_XKBVARIANT:-neo}
+NEO_XMODMAP="${NEO_XMODMAP:-/usr/share/neo-layout/xmodmap/neo_de.xmodmap}"
+NEO_CONSOLE_KEYMAP="${NEO_CONSOLE_KEYMAP:-/usr/share/keymaps/i386/neo/neo.map}"
-XMODMAP="$PFAD/neo_de.xmodmap"
-XMODMAP_XPROG="$PFAD/neo_de_x-prog.xmodmap"
-XMODMAP_ALTERNATIVE="$PFAD/neo_de_alternative.xmodmap"
-XMODMAP_EVDEV="$PFAD/neo_de_evdev.xmodmap"
+die() {
+ echo "$@" >&2
+ exit 1
+}
+set_xmodmap() {
+ if [ -e "${PATH_XMODMAP}" ]; then
+ if [ -f "$@" ]; then
+ "${PATH_XMODMAP}" "$@" || die "Failed to set xmodmap $@."
+ else
+ die "Cannot use $@ for xmodmap."
+ fi
+ else
+ die "xmodmap not found, cannot set xmodmap."
+ fi
+}
-NEO_X_VARIANTE=${1-$NEO_X_VARIANTE}
+set_xkbmap() {
+ if [ -e "${PATH_SETXKBMAP}" ]; then
+ "${PATH_SETXKBMAP}" "$@" || die "Failed to select xkbmap $@."
+ else
+ die "setxkbmap not found, cannot set xkbmap."
+ fi
+}
+set_keymap() {
+ if [ -e "${PATH_LOADKEYS}" ]; then
+ if [ -f "$@" ]; then
+ if [ "${EUID}" = 0 ]; then
+ "${PATH_LOADKEYS}" "$@" || die "Failed to set keymap $@."
+ elif [ -e "${PATH_SUDO}" ]; then
+ "${PATH_SUDO}" "${PATH_LOADKEYS}" "$@" || die "Failed to set keymap using sudo."
+ else
+ die "You need root priviliges to change the keymap."
+ fi
+ else
+ die "keymap file $@ does not exist."
+ fi
+ else
+ die "loadkeys not found, cannot set keymap."
+ fi
+}
if [ -n "$SSH_CONNECTION" ]; then
- echo -n "Dude, du bist in einer SSH-Session. Wie soll ich das "
- echo "Tastaturlayout hier ändern?"
- exit 1
+ die "Cannot set keybord layout in a ssh session."
fi
-if [ -z "$DISPLAY" ]; then
- echo -n "Um das Tastaturlayout auf der Textkonsole zu ändern, muss man"
- echo " root-Rechte besitzen!"
- sudo loadkeys $CONSOLE_KEYMAP
- setleds +num
+
+if [ -z ${DISPLAY} ]; then
+ set_keymap "${NEO_CONSOLE_KEYMAP}"
+
+ if [ -e "${PATH_SETLEDS}" ]; then
+ "${PATH_SETLEDS}" -num || die "Failed to set NUM status."
+ else
+ die "setleds does not exist, cannot set NUM status."
+ fi
else
- numlockx off
- xset -r 51; xset -r 94 # Modifier
- xset -r 21; xset -r 35; xset -r 49 # tote Tasten (dead keys)
-
- case $NEO_X_VARIANTE in
+ if [ -e "${PATH_NUMLOCKX}" ]; then
+ "${PATH_NUMLOCKX}" off || die "Failed to turn off Numlock."
+ else
+ die "numlockx not found, cannot turn off Numlock."
+ fi
+
+ if [ -e "${PATH_XSET}" ]; then
+ for modifier in 51 94; do
+ "${PATH_XSET}" -r ${modifier} || die "Failed to unset repeat for modifier ${modifier}."
+ done
+ for deadkey in 21 35 49; do
+ "${PATH_XSET}" -r ${deadkey} || die "Failed to unset repeat for deadkey ${deakey}."
+ done
+ else
+ die "xset not found, cannot set modifiers and dead keys."
+ fi
+
+ case "${NEO_X_VARIANTE}" in
xkbmap)
- setxkbmap de neo
+ set_xkbmap "${NEO_XKBMAP}" "${NEO_XKBVARIANT}"
;;
xmodmap)
- setxkbmap ie
- xmodmap $XMODMAP
- ;;
- xprog)
- setxkbmap ie
- xmodmap $XMODMAP_XPROG
- ;;
- alternative)
- setxkbmap ie
- xmodmap $XMODMAP_ALTERNATIVE
- ;;
- evdev)
- setxkbmap ie
- xmodmap $XMODMAP_EVDEV
+ set_xkbmap ie
+ set_xmodmap "${NEO_XMODMAP}"
;;
*)
- echo -n "Die Variante »${NEO_X_VARIANTE}« ist keine "
- echo "bekannte X-Variante des NEO-Layouts."
- exit 1
+ die "Unknown Neo X variant ${NEO_X_VARIANTE}."
;;
esac
fi
+
diff --git a/linux/bin/neo.conf b/linux/bin/neo.conf
new file mode 100644
index 0000000..23959f6
--- /dev/null
+++ b/linux/bin/neo.conf
@@ -0,0 +1,49 @@
+# This files contains the configuration for the Neo scripts
+
+# Select the neo Variant to be used when using an X Server
+# Values are "xkbmap" and "xmodmap", default is xkbmap, this variable should
+# always be set
+NEO_X_VARIANTE="xkbmap"
+
+# When using xkbmap, you may specify which xkbmap should be used, the default
+# is "de" (This is useful if you installed the symbols file under a different
+# name):
+#NEO_XKBMAP=de
+
+# You can also specify the xkbmap variant to be used, the default is "neo":
+#NEO_XKBVARIANT=neo
+
+# When using xmodmap, you may specify the full path to the xmodmap to be used.
+# Default:
+#NEO_XMODMAP="/usr/share/neo-layout/xmodmap/neo_de.xmodmap"
+# Other examples might be:
+#NEO_XMODMAP="path/to/xmodmap/neo_de_x-prog.xmodmap"
+#NEO_XMODMAP="path/to/xmodmap/neo_de_evdev.xmodmap"
+#NEO_XMODMAP="path/to/xmodmap/neo_de_alternative.xmodmap"
+
+# Standard keyboard layout to switch back to when executing "uiae":
+#STD_XKBMAP=de
+
+# Standard layout variant to switch back to when executing "uiae":
+#STD_XKBVARIANT=nodeadkeys
+
+# Numlock status when switching to standard keyboard layout using "uiae",
+# values are "on" and "off":
+#NUM_LOCK_STATUS=on
+
+# For Neo without an X System set the path to the console keymap
+#NEO_CONSOLE_KEYMAP="/usr/share/keymaps/i386/neo/neo.map"
+
+# Set the standard console keymap to switch back to
+#STD_CONSOLE_KEYMAP="/usr/share/keymaps/i386/qwertz/de-latin1-nodeadkeys.map.gz"
+
+# If you installed one of these programs in a non-standard path you may,
+# uncomment the variable and change the path to the executable:
+#PATH_XMODMAP=/usr/bin/xmodmap
+#PATH_SETXKBMAP=/usr/bin/setxkbmap
+#PATH_LOADKEYS=/usr/bin/loadkeys
+#PATH_SUDO=/usr/bin/sudo
+#PATH_SETLEDS=/usr/bin/setleds
+#PATH_NUMLOCKX=/usr/bin/numlockx
+#PATH_XSET=/usr/bin/xset
+
diff --git a/linux/bin/uiae b/linux/bin/uiae
index 7d0f313..3ffd1f5 100755
--- a/linux/bin/uiae
+++ b/linux/bin/uiae
@@ -1,49 +1,128 @@
#!/bin/sh
+# Copyright 2008 Bernd Steinhauser <berniyh@exherbo.org>
+# Copyright 2008 Benjamin Kellermann
+# Copyright 2008 Pascal Hauck
+# Copyright 2008 Erik Streb del Toro
+# Distributed under the terms of the GNU General Public License v3
-################################################################################
-####################### persönliche Einstellungen ##############################
-################################################################################
-# Gewünschte Konsolen-Belegungen:
-CONSOLE_KEYMAP="de"
-#CONSOLE_KEYMAP="" # leer für Standard-keymap (i.d.R. qwert)
+if [ -f "${NEO_CONFIG}" ]; then
+ . "${NEO_CONFIG}" || die "Failed to source ${NEO_CONFIG}"
+elif [ -f "${HOME}"/.neorc ]; then
+ . "${HOME}"/.neorc || die "Failed to source ${HOME}/neo.conf"
+elif [ -f /etc/neo.conf ]; then
+ . /etc/neo.conf || die "Failed to source /etc/neo.conf"
+else
+ echo "No configuration file found. Using default values, this might fail!"
+fi
+# Default paths
+PATH_XMODMAP=${PATH_XMODMAP:-/usr/bin/xmodmap}
+PATH_SETXKBMAP=${PATH_SETXKBMAP:-/usr/bin/setxkbmap}
+PATH_LOADKEYS=${PATH_LOADKEYS:-/usr/bin/loadkeys}
+PATH_SUDO=${PATH_SUDO:-/usr/bin/sudo}
+PATH_SETLEDS=${PATH_SETLEDS:-/usr/bin/setleds}
+PATH_NUMLOCKX=${PATH_NUMLOCKX:-/usr/bin/numlockx}
+PATH_XSET=${PATH_XSET:-/usr/bin/xset}
-# gewünschter Status für qwert
-NUM_LOCK_STATUS="ON"
-################################################################################
-################################################################################
-################################################################################
+# Default values
+STD_X_VARIANTE=${STD_X_VARIANTE:-xkbmap}
+STD_XKBMAP=${STD_XKBMAP:-de}
+STD_XKBVARIANT=${STD_XKBVARIANT:-nodeadkeys}
+STD_CONSOLE_KEYMAP="${STD_CONSOLE_KEYMAP:-/usr/share/keymaps/i386/qwertz/de-latin1-nodeadkeys.map.gz}"
+NUM_LOCK_STATUS=${NUM_LOCK_STATUS:-on}
+die() {
+ echo "$@" >&2
+ exit 1
+}
-CONSOLE_KEYMAP=${1-$CONSOLE_KEYMAP}
+set_xmodmap() {
+ if [ -e "${PATH_XMODMAP}" ]; then
+ if [ -f "$@" ]; then
+ "${PATH_XMODMAP}" "$@" || die "Failed to set xmodmap $@."
+ else
+ die "Cannot use $@ for xmodmap."
+ fi
+ else
+ die "xmodmap not found, cannot set xmodmap."
+ fi
+}
+set_xkbmap() {
+ if [ -e "${PATH_SETXKBMAP}" ]; then
+ "${PATH_SETXKBMAP}" "$@" || die "Failed to select xkbmap $@."
+ else
+ die "setxkbmap not found, cannot set xkbmap."
+ fi
+}
+
+set_keymap() {
+ if [ -e "${PATH_LOADKEYS}" ]; then
+ if [ -f "$@" ]; then
+ if [ "${EUID}" = 0 ]; then
+ "${PATH_LOADKEYS}" "$@" || die "Failed to set keymap $@."
+ elif [ -e "${PATH_SUDO}" ]; then
+ "${PATH_SUDO}" "${PATH_LOADKEYS}" "$@" || die "Failed to set keymap using sudo."
+ else
+ die "You need root priviliges to change the keymap."
+ fi
+ else
+ die "keymap file $@ does not exist."
+ fi
+ else
+ die "loadkeys not found, cannot set keymap."
+ fi
+}
if [ -n "$SSH_CONNECTION" ]; then
- echo -n "Dude, du bist in einer SSH-Session. Wie soll ich das "
- echo "Tastaturlayout hier ändern?"
- exit 1
+ die "Cannot set keybord layout in a ssh session."
fi
-if [ -z "$DISPLAY" ]; then
- echo -n "Um das Tastaturlayout auf der Textkonsole zu ändern, muss man"
- echo " root-Rechte besitzen!"
- if [ $CONSOLE_KEYMAP ] ; then
- sudo loadkeys $CONSOLE_KEYMAP
+
+if [ -z ${DISPLAY} ]; then
+ set_keymap "${NEO_CONSOLE_KEYMAP}"
+
+ if [ -e "${PATH_SETLEDS}" ]; then
+ if [ "${NUM_LOCK_STATUS}" = "on" ]; then
+ "${PATH_SETLEDS}" +num || die "Failed to set num lock status to on."
+ else
+ "${PATH_SETLEDS}" -num || die "Failed to set num lock status to off."
+ fi
else
- sudo loadkeys -d
+ die "setleds does not exist, cannot set NUM status."
fi
- if [ NUM_LOCK_STATUS="ON" ] ; then
- setleds +num
+else
+ if [ -e "${PATH_XSET}" ]; then
+ for modifier in 51 94; do
+ "${PATH_XSET}" r ${modifier} || die "Failed to set repeat for modifier ${modifier}."
+ done
+ for deadkey in 21 35 49; do
+ "${PATH_XSET}" r ${deadkey} || die "Failed to set repeat for deadkey ${deakey}."
+ done
else
- setleds -num
+ die "xset not found, cannot set modifiers and dead keys."
fi
-else
- xset r 51; xset r 94 # Modifier
- xset r 21; xset r 35; xset r 49 # tote Tasten (dead keys)
- setxkbmap de
- if [ NUM_LOCK_STATUS="ON" ] ; then
- numlockx on
+
+ case "${NEO_X_VARIANTE}" in
+ xkbmap)
+ set_xkbmap "${STD_XKBMAP}" "${STD_XKBVARIANT}"
+ ;;
+ xmodmap)
+ set_xkbmap de
+ set_xmodmap "${STD_XMODMAP}"
+ ;;
+ *)
+ die "Unknown standerd X variant ${STD_X_VARIANTE}."
+ ;;
+ esac
+
+ if [ -e "${PATH_NUMLOCKX}" ]; then
+ if [ "${NUM_LOCK_STATUS}" = "on" ]; then
+ "${PATH_NUMLOCKX}" on || die "Failed to set num lock status to on."
+ else
+ "${PATH_NUMLOCKX}" off || die "Failed to set num lock status to off."
+ fi
else
- numlockx off
+ die "numlockx not found, cannot turn off Numlock."
fi
fi