Score:1

Remapping gaming mouse buttons to key combinations

ru flag

I have Razer Deathadder Elite gaming mouse. I wanted to remap its two side buttons so that I would be able to switch between workspaces. I have seen this: Remapping mouse buttons to keyboard keys, but could not figure out how to map the buttons to key combinations (i.e. Ctrl+Alt+Up and Ctrl+Alt+Down).

Update

Looked at this: How to bind mouse buttons to keys? Tried adding the code below to .xbindkeysrc:

# Ctrl+Alt+Down press
"xte 'keydown Control_L' 'key Alt_L' 'key Down'"
    b:8

# Ctrl+Alt+Down release
"xte 'keyup Control_L' 'keyup Alt_L' 'keyup Down'"
    b:8 + Release

# Ctrl+Alt+Up press
"xte 'keydown Control_L' 'key Alt_L' 'key Up'"
    b:9

# Ctrl+Alt+Up release
"xte 'keyup Control_L' 'keyup Alt_L' 'keyup Up'"
    b:9 + Release

Still cannot get it to work.

Sadaharu Wakisaka avatar
pl flag
Welcome to AskUbuntu, might this help you then? https://askubuntu.com/questions/9048/how-to-bind-mouse-buttons-to-keys?rq=1
Trafalgar Law avatar
ru flag
@Sadaharu Wakisaka, still can't understant how to map Ctrl+Alt+Up and Ctrl+Alt+Down. Tried `"xte 'keydown Control_L' 'key Alt_L' 'key Down'"`, still can't get it to work.
Sadaharu Wakisaka avatar
pl flag
Check `xte` is installed or not. Restart service `killall xbindkeys ; xbindkeys`
Score:0
id flag

I had the same exact question for nearly the same exact purpose recently; figured it out:

# Ctrl + Alt + Down on Mouse8
"xte 'keydown Control_L' 'keydown Alt_L' 'key Down' 'keyup Alt_L' 'keyup Control_L'"
    b:8

# Ctrl + Alt + Up on Mouse9
"xte 'keydown Control_L' 'keydown Alt_L' 'key Up' 'keyup Alt_L' 'keyup Control_L'"
    b:9

I still couldn't figure out (just like you) why I couldn't "keyup" the three keys on a button release, but holding down the two modifiers, keying the arrow, then releasing the two modifiers worked out much better.

Just a note in your question, you were not holding down the Alt and Down/Up keys like you seemed to try (you used "key" instead of "keydown" on the press calls). Even then, the single-line press-release was the only way I got it to work.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.