You are not logged in.

#1 2019-03-26 19:24:23

wuhanwio
Member
Registered: 2019-03-26
Posts: 1

how to remap a mouse button key to a modifier key?

I would like to remap the physical mouse button with a modifier key.

Currently I have succesfully remapped the following keys:

    # make capslock behave like ctrl
    setxkbmap -option ctrl:nocaps

    # make short-pressed Ctrl behave like Escape
    xcape -e "Control_L=Escape"

This result in the physical caps-lock key behaves as two keys, namely:

   Press and release Caps-Lock = Escape
   Press Caps-Lock and combine with <any key> key = Ctrl + <any key>

I want to take the example as explained above to remap my mouse buttons.
I'm having a laptop with key buttons right under the space bar (Thinkpad), which would be less straining to use, for example as a modifier keys.

The behavior I want is:

   Remap mouse button 1 to Super key.
   Remap mouse button 3 to Alt key.

This would result in:

   Press mouse button 1 and release = left mouse button (so nothing changed here)
   Press mouse button 1 and combine with <any key> = Super (modifier key) + <any> key
   Press mouse button 3 and release left mouse button = left mouse button (so nothing changed here)
   Press mouse button 3 and combine with <any key> = Alt (modifier key) + <any> key

I have looked to different possible solutions:

   xcape (Didn't find out how to remap a mouse button key with a modifier)

   xmodmap (Didn't find out how to remap a mouse button key with a modifier)

   xbindkeys (On this this one, it was possible to remap the mouse button key, but it didn't work when it was combined with other key. Also, the assigned key didn't work on its physical place.)

   setxkbmap (Didn't find out how to swap mouse button key with a regular key)

But none of them I found out the how to remap a regular key to a mouse button.

Hopefully someone can help me.

Thank you.

Last edited by wuhanwio (2019-03-26 19:26:49)

Offline

#2 2019-03-28 01:10:35

mountaineerbr
Banned
Registered: 2018-12-08
Posts: 48

Re: how to remap a mouse button key to a modifier key?

Maybe these identifier may help

<Btn1Down>

X11 Mouse Button Numbering

    1 = left button.
    2 = middle button (pressing the scroll wheel)
    3 = right button.


Also, sometimes you must use different denominations as MOD1 (Alt) or MOD4(Super)...
Sometimes, programmes use the Meta naming for the modifier Super.

https://unix.stackexchange.com/question … super-keys

PS: Maybe you cannot remap right clicks alone... I read it somewhere...

Last edited by mountaineerbr (2019-03-28 01:28:22)

Offline

Board footer

Powered by FluxBB