SHA256
1
0
forked from pool/xterm
xterm/Backarrow2BackSpace

43 lines
806 B
Bash

#!/bin/bash
#
# Backarrow2BackSpace: Switch Backarrow key to BackSpace
#
# 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-H (ASCII BackSpace) for Backarrow key
#
echo -en '\033[?67h' > /dev/tty
#
# Change terminal settings accordingly
#
stty erase '^H' < /dev/tty
exit 0