Score:0

Remapping of key with xmodmap is detected by xev but not by other apps?

ar flag

So as I bought a laptop with a foreign keyboard (qwerty but I type in azerty most of the time) I don't have any dedicated key for chevrons (<>). That's annoying, so I want to remap my right control key (which I never use anyway) as a key for chevrons. I am running on Ubuntu, so I used xev to detect which key is where, and did the xmodmap thing as described here which is basically outputing the current keyboard layout in a .Xmodmap file with xmodmap pke > .Xmodmap, modifying the keys where they need to be modified, saving and closing the file and running xmodmap .Xmodmap in the shell.

The problem I currently have is that it doesn't seem to be detected by other applications. Xev detects it just fine, but I can't make a chevron when using firefox for example, the key still works as a control key anywhere but in xev. I have tried googling. This question looked like it was exactly what I was looking for but the lack of answers was unhelpful, and I have not encountered other similar problems, it seems to just work fine for everyone.

Here is the xev output when I press my right control key, I include it in case it would contain any clue as to why it's not detected by other apps (I only included the KeyPress events to ease reading, the KeyRelease event looks the same):

KeyPress event, serial 37, synthetic NO, window 0x2000001,
    root 0x49d, subw 0x0, time 1612206, (1243,666), root:(1355,775),
    state 0x2011, keycode 59 (keysym 0x3c, less), same_screen YES,
    XKeysymToKeycode returns keycode: 94
    XLookupString gives 1 bytes: (3c) "<"
    XmbLookupString gives 1 bytes: (3c) "<"
    XFilterEvent returns: False


KeyPress event, serial 37, synthetic NO, window 0x2000001,  # this is the left shift key
    root 0x49d, subw 0x0, time 1613158, (1243,666), root:(1355,775),
    state 0x2010, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x2000001,
    root 0x49d, subw 0x0, time 1613404, (1243,666), root:(1355,775),
    state 0x2011, keycode 60 (keysym 0x3e, greater), same_screen YES,
    XKeysymToKeycode returns keycode: 94
    XLookupString gives 1 bytes: (3e) ">"
    XmbLookupString gives 1 bytes: (3e) ">"
    XFilterEvent returns: False

I have not yet tried to automate the behavior as it doesn't even work when not automated. Does anyone know why this might happen and how to solve it ? Thank you for your time.

Edit : The line I modified in my .Xmodmap file is this one :

keycode 105 = less greater less greater Control_R NoSymbol Control_R NoSymbol Control_R

(I added the less greater the beginning)

The command setxkbmap -query outputs this :

rules:      evdev
model:      pc105
layout:     us
David avatar
cn flag
What is the version of Ubuntu?
Gunnar Hjalmarsson avatar
uz flag
Are you using Ubuntu on Wayland?
rznrd avatar
ar flag
@David Ubuntu is 22.04.2 LTS !
rznrd avatar
ar flag
@GunnarHjalmarsson I'm not using ubuntu on wayland
Andra avatar
tr flag
do you have one layout or more? what's the output of `setxkbmap -query` in terminal?
rznrd avatar
ar flag
@Andra I have the french azerty keyboard and the english qwerty keyboard layout installed, my .Xmodmap file has this line (key 105 is the right ctrl key) : `keycode 105 = less greater less greater Control_R NoSymbol Control_R NoSymbol Control_R `. The output of setxkbmap -query is `rules: evdev model: pc105 layout: us`
Andra avatar
tr flag
it seems you need to remove right ctrl form controls: add `remove control = Control_R` to your script file. Just before you do it, execute `xmodmap` in terminal and look at the result for `Control_R`.
rznrd avatar
ar flag
@Andra thank you, it worked ! Now I can type those <><><>
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.