xterm/Backarrow2Delete

43 lines
797 B
Bash

#!/bin/bash
#
# Backarrow2Delete: Switch Backarrow key to Delete
#
# Copyright (c) 1998 S.u.S.E. GmbH Fuerth, Germany.
# please send bugfixes or comments to feedback@suse.de.
#
# Author: Werner Fink, <werner@suse.de>
#
# Some checks
#
case "$TERM" in
xterm*) ;;
*) echo "${0##*/}: TERM=$TERM is not for an xterm!" 1>&2
exit 1
esac
tty -s || { echo "{0##*/}: Not a tty!" 1>&2 ; exit 1; }
#
# Restore default X key mapping for standard PC keyboards
#
case "$(uname -s)" in
Linux)
xmodmap -e 'keycode 22 = BackSpace BackSpace 3270_DeleteWord'
xmodmap -e 'keycode 107 = Delete'
;;
*)
# Don't know
esac
#
# Switch to Ctrl-? (ASCII Delete) for Backarrow key
#
echo -en '\033[?67l' > /dev/tty
#
# Change terminal settings accordingly
#
stty erase '^?' < /dev/tty
exit 0