Skip to content

Instantly share code, notes, and snippets.

@psygo
Created May 25, 2020 12:48
Show Gist options
  • Save psygo/6f1c8abb9d8a4bf989aeb22ae486e5ad to your computer and use it in GitHub Desktop.
Save psygo/6f1c8abb9d8a4bf989aeb22ae486e5ad to your computer and use it in GitHub Desktop.
Customize Keyboard on Ubuntu (UNIX)
#!/bin/bash
KEYCODE="keycode"
xmodmap -e "${KEYCODE} 83 = Left" # KP_4
xmodmap -e "${KEYCODE} 80 = Up" # KP_8
xmodmap -e "${KEYCODE} 85 = Right" # KP_6
xmodmap -e "${KEYCODE} 84 = Down" # KP_5
xmodmap -e "${KEYCODE} 88 = Down" # KP_2
xmodmap -e "${KEYCODE} 90 = Delete" # Insert
xmodmap -e "${KEYCODE} 77 = Delete" # Num_Lock
xmodmap -e "${KEYCODE} 81 = " # PgUp
xmodmap -e "${KEYCODE} 89 = " # PgDn
xmodmap -e "${KEYCODE} 63 = " # KP_Multiply
xmodmap -e "${KEYCODE} 82 = " # KP_Subtract
xmodmap -e "${KEYCODE} 86 = " # KP_Add
xmodmap -e "${KEYCODE} 106 = " # KP_Divide
xmodmap -e "${KEYCODE} 129 = " # KP_Decimal
xmodmap -e "${KEYCODE} 125 = " # KP_Equal
xmodmap -e "${KEYCODE} 104 = KP_Enter" # KP_Enter
CONFIG_FILE="/home/${USER}/.Xmodmap"
INIT_CONFIG_FILE="/home/${USER}/.xinitrc"
xmodmap -pke > "${CONFIG_FILE}"
touch "${INIT_CONFIG_FILE}"
printf "xmodmap .Xmodmap" > "${INIT_CONFIG_FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment