Skip to content

Instantly share code, notes, and snippets.

@image72
Forked from ryukinix/get-keycodes.sh
Created September 18, 2020 14:27
Show Gist options
  • Save image72/34cd5031e42a5be70e8bcb6eb0333fb6 to your computer and use it in GitHub Desktop.
Save image72/34cd5031e42a5be70e8bcb6eb0333fb6 to your computer and use it in GitHub Desktop.
A command to get the keycodes of your keyboard and configure your ~/.Xmodmap
#!/usr/bin/env bash
# A command to get the keycodes of your keyboard and configure your ~/.Xmodmap
# I used that for configure my multimedia-keys on XFCE4 @ Manjaro
xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
# [e.g.: ~/.Xmodmap
# keycode 162 = XF86AudioPlay
# keycode 164 = XF86AudioStop
# keycode 160 = XF86AudioMute
# keycode 144 = XF86AudioPrev
# keycode 153 = XF86AudioNext
# keycode 176 = XF86AudioRaiseVolume
# keycode 174 = XF86AudioLowerVolume
# keycode 237 = XF86AudioMedia
# keycode 230 = XF86Favorites
# keycode 236 = XF86Mail
# keycode 178 = XF86WWW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment