Skip to content

Instantly share code, notes, and snippets.

@mingyuchoo
Last active February 9, 2024 02:21
Show Gist options
  • Save mingyuchoo/492b762d17781847b6a8063af990d610 to your computer and use it in GitHub Desktop.
Save mingyuchoo/492b762d17781847b6a8063af990d610 to your computer and use it in GitHub Desktop.
How to change keys in Linux

How to change keys in Linux

This document contains an example of exchanging the behavior of the backslash and backspace keys on a Linux system.

Prerequisite

Install xmodmap and xev in my NixOS

$ nix-shell -p xorg.xmodmap
$ nix-shell -p xorg.xev

Add .xmodmaprc file in $HOME

$ touch .xmodmaprc
$ emacs .xmodmaprc

Add keycode to exchange. To exchange the actions of the backslash key and the backspace key, use keycodes 22 and 51 as shown below.

!.xmodmaprc
keycode 22 = backslash bar
keycode 51 = BackSpace

Re-login to your X-window

Re-login or Reboot your X-window system.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment