[PLUG] Swapping key functions with .Xmodmap

Bryan Linton plug at shoshoni.info
Thu Nov 16 22:31:17 UTC 2017


On 2017-11-16 08:06:18, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>
> [...]
> 
>   I tried modifying my existing .Xmodmap which swaps the left CapsLock and
> Ctrl keys by copying the remove and add sequence for Super_L and Alt_L.
> Unfortuately, xmodmap did not like this:
> 
> 	remove Lock = Caps_Lock
> 	remove Control = Control_L
> 	remove Super = Super_L
> 	remove Alt = Alt_L
> 	keysym Control_L = Caps_Lock
> 	keysym Caps_Lock = Control_L
> 	keysym Alt_L = Super_L
> 	keysym Super_L = Alt_L
> 	add Lock = Caps_Lock
> 	add Control = Control_L
> 	add Super = Super_L
> 	add Alt = Alt_L
> 	keysym Alt_L = Meta_L Alt_L
> 
>   I must have a syntax error that I don't recognize. A clue stick is needed.
> 

Fair warning, I'm running OpenBSD and not Linux, but I'm in a
similar situation.  I have a Japanese keyboard, which means that
the spacebar is about 2 inches long.  I've mapped the specialized
kanji conversion keys (one to the left, and two to the right) to
function as the spacebar too.

I've also remapped Caps_Lock to be Control, without bothering to
remap Caps_Lock anywhere else.  There are also a few other changes
that are commented.  You most likely won't want or need these.

My .xmodmap is the following:

	remove Lock = Caps_Lock
	keysym Caps_Lock = Escape

	! These are for the Thinkpad keys
	keycode 234 = XF86Back
	keycode 233 = XF86Forward

	! This maps the kanji-conversion keys to <space>
	keycode 129 = space
	keycode 131 = space
	keycode 208 = space

	! Map the yen key to backspace (or backslash/pipe)
	!keycode 133 = BackSpace
	keycode 133 = backslash bar

	! Map PrtScr to Compose
	keycode 111 = Multi_key

My first suggestion would be to see if you can simply remap them
without trying to use the "remove" keyword.  If that doesn't work,
I wonder if using the keycode xev gives you instead of the keysym
is what xmodmap is expecting.

In the following line from xev,
	
	state 0x0, keycode 115 (keysym 0xffeb, Super_L), same_screen YES

Notice that the keycode for my left Windows key is 115, and the
keysym is "Super_L".

Hopefully that gives an idea of where to start.  If not, please
report back to the list.

I hope this helps!

-- 
Bryan




More information about the PLUG mailing list