Skip to content

Instantly share code, notes, and snippets.

@JTRNS
Created March 9, 2021 20:23
Show Gist options
  • Save JTRNS/094cf95ee7179a4117c726734cb81537 to your computer and use it in GitHub Desktop.
Save JTRNS/094cf95ee7179a4117c726734cb81537 to your computer and use it in GitHub Desktop.
write first, edit later
#!/bin/bash
# write first, edit later
# toggles the function of the backspace key between
# its normal function and that of the delete key
# Keycode might be different for other keyboards!
# to find the right keycode on your hardware use:
# xev -event keyboard
keyValue=$(xmodmap -pke | grep "keycode 22")
if [[ "$keyValue" =~ "BackSpace" ]]; then
echo "Typewriter mode activated"
xmodmap -e "keycode 22 = Delete"
else
echo "Typewriter mode disabled"
xmodmap -e "keycode 22 = BackSpace"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment