I'm struggling with changing one keybind with xmodmap
. AltGr + P outputs þ
, but I would like to change it to output '
.
xmodmap -pm
outputs:
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
I can't seem to attach Alt_R
as one of the modifiers (unless its there as ISO_Level3_Shift
or Mode_switch
). Here is what xev
shows:
# - p
KeyRelease event, serial 41, synthetic NO, window 0x4800001,
root 0x2b8, subw 0x0, time 194353, (300,-235), root:(366,280),
state 0x10, keycode 33 (keysym 0x70, p), same_screen YES,
XLookupString gives 1 bytes: (70) "p"
XFilterEvent returns: False
# - altgr
KeyRelease event, serial 41, synthetic NO, window 0x4800001,
root 0x2b8, subw 0x0, time 216040, (249,-329), root:(315,186),
state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XFilterEvent returns: False
# - altgr+p
KeyPress event, serial 41, synthetic NO, window 0x4800001,
root 0x2b8, subw 0x0, time 230879, (218,-187), root:(284,328),
state 0x90, keycode 33 (keysym 0xfe, thorn), same_screen YES,
XLookupString gives 2 bytes: (c3 be) "þ"
XmbLookupString gives 2 bytes: (c3 be) "þ"
XFilterEvent returns: False
Whenever I tried to change the binding, it either adds '
instead of p
or the cobination doesn't do anything.
Update:
Aphostrophe currently shows when I press AltGr + J.
Update 2:
xmodmap -e "keysym THORN = apostrophe"
changes P to '
even though xev outputs THORN
after pressing AltGr + P
Best Answer
See the output of
xmodmap -pke
to understand how the "values" of the keys are assigned. For example, by default, if you are using English (UK) keyboard layout,xmodmap -pke | grep "thorn"
will return:That being said, assuming that you are using English (UK) keyboard layout, use the following command to type apostrophe when you press AltGr + P:
To get this change for every session, create a file called
.xmodmap
, with the following command:Then, create a file called
.xinitrc
in your home directory, containing the following line/command: