Okay, I have solved my problem, let’s see if it helps you too.
First and foremost, my claim that “x knows it is the alt key” was not completely true. I did not inspect the xev output properly. Here is the sample output after pressing left alt and right alt, respectively:
KeyPress event, serial 40, synthetic NO, window 0x5400001,
root 0xa2, subw 0x0, time 88340, (67,-15), root:(821,8),
state 0x10, keycode 64 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 40, synthetic NO, window 0x5400001,
root 0xa2, subw 0x0, time 88436, (67,-15), root:(821,8),
state 0x90, keycode 64 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 40, synthetic NO, window 0x5400001,
root 0xa2, subw 0x0, time 89884, (67,-15), root:(821,8),
state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 64
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 40, synthetic NO, window 0x5400001,
root 0xa2, subw 0x0, time 89956, (67,-15), root:(821,8),
state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 64
XLookupString gives 0 bytes:
XFilterEvent returns: False
As one can see, neither are really recognized as proper alt keys but as 3rd level shortcut triggers (ISO_Level3_Shift). I missed this the first time because I was only looking at keycodes, which of course return different results for different keys, regardless of the mapping. So, both my alt keys were mapped to ISO_Level3_Shift… That reminded me of a setting in the keyboard settings at kde control module.
I navigated to “KDE Control Module->Keyboard”, and in “Layouts” tab, I saw that my 3rd level shortcuts are assigned to “Any Alt key”, and subsequently there was no binding that was functionally Alt_L or Alt_R! I cleared that option to “None” to see what happens, and voila! I have my alt key back. Now xev reports this for my left and right alt keys:
KeyPress event, serial 40, synthetic NO, window 0x5a00001,
root 0xa2, subw 0x0, time 1138019, (-114,637), root:(640,660),
state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 40, synthetic NO, window 0x5a00001,
root 0xa2, subw 0x0, time 1138083, (-114,637), root:(640,660),
state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 40, synthetic NO, window 0x5a00001,
root 0xa2, subw 0x0, time 1139307, (-114,637), root:(640,660),
state 0x10, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 40, synthetic NO, window 0x5a00001,
root 0xa2, subw 0x0, time 1139395, (-114,637), root:(640,660),
state 0x18, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
I don’t know if this problem exists for non-Macs, but I doubt it. Otherwise these pages would be overflowing with desperate people.
This solved my problem, and perhaps it can at least alleviate the alt-key portion of your problem. Good luck!
PS: Can you perhaps the output of xev when you press your alt and meta keys? Perhaps there is something you are missing there, like I was missing in mine. Also, I agree with the other poster that you should change the title to include that this is probably a Mac thing. As I, and the other poster, have said, otherwise this thread would be pages long by now.