Skip to content
Search

Xmodmap

lastmod 2023-12-31created 2020-08-2314 edits

xmodmap - utility for modifying keymaps and pointer button mappings in X

Synopsis

$ xmodmap [-options ...] [filename]

Config file

The filename specifies a file containing xmodmap expressions to be executed. This file is usually kept in the user's home directory with a name like .xmodmaprc.

Description

The xmodmap program is used to edit and display the keyboard modifier map and keymap table that client applications use to convert event keycodes into keysyms. It is usually run from the user's session startup script to configure the keyboard according to personal tastes.

Options

The following options may be used with xmodmap:

-display display
This option specifies the host and display to use.
-help
This option indicates that a brief description of the command-line arguments should be printed on the standard error channel. This is done whenever an unhandled argument is given to xmodmap.
-grammar
This option indicates that a help message describing the expression syntax used with files and -e expressions should be printed on standard error.
-verbose
This option indicates that xmodmap should print logging information as it parses its input.
-quiet
This option turns off verbose logging. This is the default.
-n
This option indicates that xmodmap should not change the mappings, but should display what it would do, like make(1) does when given this option.
-e expression
This option specifies an expression to be executed. Multiple expressions may be specified on the command line.
-pm
This option indicates that the current modifier map should be printed on the standard output. This is the default mode of operation if no other mode options are specified.
-pk
This option indicates that the current keymap table should be printed on the standard output.
-pke
This option indicates that the current keymap table should be printed on the standard output in the form of expressions that can be fed back to xmodmap.
-pp
This option indicates that the current pointer map should be printed on the standard output.
-
A lone dash means that the standard input should be used as the input file.

Examples

Entering the command below saves the layout currently in use. Preparing a backup in advance lets you guard against unexpected problems.

$ xmodmap -pke > ~/xmodmap_original

Super key copy

remove mod4 = Super_L
keysym Super_L = Control_L
add Control = Control_L

macOS configuration

! -*- coding: utf-8 -*-

! macOS-like key mapping

! default mapping
! keycode 37 = Control_L NoSymbol Control_L
! keycode 64 = Alt_L Meta_L Alt_L Meta_L
! keycode 92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
! keycode 105 = Control_R NoSymbol Control_R
! keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
! keycode 133 = Super_L NoSymbol Super_L
! keycode 134 = Super_R NoSymbol Super_R
! keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
! keycode 206 = NoSymbol Super_L NoSymbol Super_L

! moddified mapping
clear control
clear mod1
clear mod4
clear mod5
keycode 37 = Super_L NoSymbol Super_L
keycode 108 = Alt_R NoSymbol Alt_R
keycode 133 = Control_L NoSymbol Control_L
keycode 134 = Control_R NoSymbol Control_R
add control = Control_L Control_R
add mod1 = Alt_L Meta_L
add mod4 = Super_L Super_R
add mod5 = Alt_R Meta_R

See also

Favorite site

author Zer0 sitemap