You are not logged in.

#1 2022-01-01 10:21:31

upper-dev
Member
Registered: 2021-12-30
Posts: 7

[SOLVED] Xmodmap AltGr key Not Functioning

i made a custom keymap using xmodmap the map file is just a copy of the ch (de_CH-latin1) keyboard only swapping the Y and Z keys
the map worked flawlessly until i tried accessing [ ]  # { } and others (i just copied these from a website)
pressing the AltGr key has no function what so ever, pressing AltGr + q returns q,
AltGr + 2 expected to return @ instead returns 2
this is the output of the xmodmap command:

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)

the AltGr keycode is 92 found out using xev and this is the output:

KeyRelease event, serial 34, synthetic NO, window 0x1400001,
    root 0x79c, subw 0x0, time 1360172, (52,745), root:(701,804),
    state 0x80, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

and in the map file this is what the AltGr key assigned to:

keycode  92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift

so what am i doing wrong here?

Last edited by upper-dev (2022-01-01 16:00:05)

Offline

#2 2022-01-01 14:37:26

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,154

Re: [SOLVED] Xmodmap AltGr key Not Functioning

What's assigned to the 3rd level shift of q?

xmodmap -pk | grep 24

(assuming q is on kc 24)

Also what't the output of "setxkbmap -print -query" and you ~/.Xmodmap?

Offline

#3 2022-01-01 15:03:07

upper-dev
Member
Registered: 2021-12-30
Posts: 7

Re: [SOLVED] Xmodmap AltGr key Not Functioning

seth wrote:

What's assigned to the 3rd level shift of q?

xmodmap -pk | grep 24

(assuming q is on kc 24)

Also what't the output of "setxkbmap -print -query" and you ~/.Xmodmap?

running "xmodmap -pk | grep 24" outputs:

24    	0x0071 (q)	0x0051 (Q)	0x0071 (q)	0x0051 (Q)	0x0040 (at)	0x07d9 (Greek_OMEGA)	0x0040 (at)

the output of "setxkbmap .print -query" is:

xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us+inet(evdev)"	};
	xkb_geometry  { include "pc(pc105)"	};
};
rules:      evdev
model:      pc105
layout:     us

this does not apply for Q only but all keys

Offline

#4 2022-01-01 15:06:45

upper-dev
Member
Registered: 2021-12-30
Posts: 7

Re: [SOLVED] Xmodmap AltGr key Not Functioning

Update: i found a some what of a solution, setting my layout to any other keymap using setxkbmap and adding "-option lv3:ralt_switch" then switching to my custom keymap fixes the issue, only temporarily

Offline

#5 2022-01-01 15:10:57

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,154

Re: [SOLVED] Xmodmap AltGr key Not Functioning

You're currently running an us layout while your OP states "de_CH-latin1" - what exactly are you doing there to being with?

setxkbmap -layout ch -variant de

will set the ch/de layout (which is also the ch default, so you can theoretically skip the variant)

You either want to derive an xkb map from /usr/share/X11/xkb/symbols/ch or use the standard ch and augment it w/ a basic xmodmap call that just toggles Y & Z for a (I assume) qwerty layout.

Offline

#6 2022-01-01 15:46:02

upper-dev
Member
Registered: 2021-12-30
Posts: 7

Re: [SOLVED] Xmodmap AltGr key Not Functioning

seth wrote:

You're currently running an us layout while your OP states "de_CH-latin1" - what exactly are you doing there to being with?

setxkbmap -layout ch -variant de

will set the ch/de layout (which is also the ch default, so you can theoretically skip the variant)

You either want to derive an xkb map from /usr/share/X11/xkb/symbols/ch or use the standard ch and augment it w/ a basic xmodmap call that just toggles Y & Z for a (I assume) qwerty layout.

i fixed it. not exactly, i kept searching around and it's most likely an xmodmap bug, i fixed the keymap and i made it a ch layout, worked fine at first but the problem occurred once again after reboot or restart the same xmodmap keymap file that was ch layout became us.

what i ended up doing is not using xmodmap since the change is very simple i copied /usr/share/X11/xkb/symbols/ch (the original keymap) to the same directory and renamed it to ch1, i used vim to edit and only swap the keycodes of Z and Y in the copy file, i used setxkbmap -layout ch1 and it worked flawlessly, even after messing around, restarting and rebooting it worked fine.

another interesting behavior happened while using the broken xmodmap keymap when i press AltGr then typing any other letter after that it doubles, exmaple:
AltGr + s = ss
AltGr + AltGr + s = ssss
AltGr + AltGr + AltGr + s = sssssss
AltGr + AltGr + AltGr + AltGr + s = ssssssssssssss

and so on

this happens for all keys

i don't know the cause of this behavior but it's indeed quite weird
i wouldn't call this a solution for the issue but i'll let that for you to decide

Offline

#7 2022-01-01 15:55:30

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,154

Re: [SOLVED] Xmodmap AltGr key Not Functioning

The basic US layout doesn't have altgr and it's hard to say what happened w/o the actuall xmodmap file.
xmodmap is not (anymore) a good tool to define entire layouts but for qnd augmentations, so the derived ch1 layout is a good solution and theoretically usable by wayland compositors as well (unlike xmodmap would be)

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB