Override mod4 for meta


#1

Is there a way to override mod4 (win/mac) key to be the meta key as many software applications have preconfigured shortcuts to use Meta key instead of Mod4.


#2

This is more an X thing than FreeBSD, but yes, there is a way to do this.

You can do this using xmodmap(1x). The man page has lots of examples that should give you enough pointers to what you want.

You can also create a .Xmodmap file and have xmodmap read it in your .xprofile.

Hope this helps.


#3

I’ll try Xmodmap, I though I could override it using below settings in. Except for ctrl:nocaps no other setting get’s picked up.

/usr/local/etc/X11/xorg.conf.d/mac.conf

Section "InputClass"
        Identifier "keyboard defaults"
        MatchIsKeyboard "on"

        Option "XkbModel" "macintosh"
        Option "XkbLayout" "us"
        Option "XkbVariant" ",altgr-intl"
        Option "XkbOptions" "ctrl:nocaps"
EndSection

#4

It depends on what you are running. IIRC, during start up Lumina tries to set the keyboard in X and it might stomp on your options. You can try running setxkbmap after everything is up with the same options. So:

setxkbmap -model macintosh -layout us -variant ",altgr-int" -option "ctrl:nocaps"

If things work then, then the desktop environment may be changing the layout underneath you.

Having made a custom keyboard map, I’ve been stung by this on several X-based desktops, so I’ve put this into a quick script I can run when things go bad.

Hope this helps!