LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to use xmodmap to get Super_R to work as AltGr? (https://www.linuxquestions.org/questions/linux-general-1/how-to-use-xmodmap-to-get-super_r-to-work-as-altgr-4175588515/)

Changes 09-01-2016 03:37 PM

How to use xmodmap to get Super_R to work as AltGr?
 
I'm using an Apple USB Keyboard on a non-Apple computer running Antergos. It's all nice except it has no AltGr key, and that makes it a problem to do square brackets and such (I tried ctrl+alt instead of altgr and it doesn't work). I never use the right Super key, so I'd like to get that working as AltGr.

I've read this and this this, but I haven't managed to get it working as I want.

Here's how xmodmap -pke shows the relevant keys:

keycode 134 = Super_R NoSymbol Super_R

keycode 92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift

Now, if I do:

xmodmap -e "keycode 134 = ISO_Level3_Shift"

I can get it to kinda-sorta work, in that it will do the brackets, but it won't do the Euro key (showing me a file explorer window instead) because it's still *also* bound to Super_R. I understand I need to use the clear option beforehand to prevent this from happening, but that's where I run into trouble. Mod4 is the modifer Super is usually bound to, but if I do:

xmodmap -e "clear mod4"

it makes it behave as if Super is *always* pressed - if I clear it and then hit d on the keyboard it shows me the desktop, for instance.

Where am I going wrong?

Edit: solved!

I had a flash of realization and figured it out. Mod4 needs to be cleared, then re-added to Super_L, otherwise it's empty and it freaks out (for lack of a better definition). In case anyone else needs this, the commands are:

xmodmap -e "clear mod4" && xmodmap -e "add mod4 = Super_L"
xmodmap -e "keycode 134 = ISO_Level3_Shift"

It's important to do the first two in the same line, otherwise as soon as you clear mod4 you won't be able to input the other part as you'll be shown the desktop as soon as you type the "d" in "xmodmap".

The configuration file to run xmodmap automatically contains:

clear mod4
add mod4 = Super_L
keycode 134 = ISO_Level3_Shift

unSpawn 09-01-2016 06:39 PM

Thanks for posting your fix. Off of the 0-reply list now.


All times are GMT -5. The time now is 05:50 AM.