12

I recently purchased a Microsoft Sculpt Comfort Mouse. It uses Bluetooth to connect to my laptop and all regular mouse buttons work perfect under both Linux and Windows 7. What's different about this mouse, though, is that it has a special Windows/Super key on the side that launches the start/menu when pressed. It also has a touch sensor that detects when the side button is stroked up or down and vibrates the mouse to acknowledge it's been activated.

Of course in Windows there is a program that lets me change what the strokes do and turn off the vibration.

In Linux, xev detects only a normal keystroke when the side button is pressed or swiped. Xev doesn't report any mouse button presses.

So my question is, can I change what key presses are sent when under Linux?

I would love to change the key binding from tab to down, backspace to up, (what xev reports) to ctrl+alt+left/right to switch between workspaces.

Thanks for any help!

  • Did you check out the howto for mice at help.ubuntu.com/community/ManyButtonsMouseHowto ? – ubfan1 Mar 27 '14 at 21:32
  • 1
    Thanks for the tip ubfan1, xinput get-button-map gives me 13 buttons. xev and xinput test report only buttons 1-7. I tried remapping buttons 8-13 using xinput set-button-map and xbindkeys from link but nothing changed. Pressing the side key reports key press 133 (super), swipe up reports key press 22 (backspace), swipe down reports key press 23 (tab). – user223544 Mar 29 '14 at 0:38
5

I just bought one myself and found that the following workes perfectly for me.

  1. Open dconf-editor (sudo apt-get install dconf-editor if it isn't already installed).
  2. Navigate to org -> gnome -> desktop -> wm -> keybindings.
  3. Change the value of switch-to-workspace-down to

    ['<Control><Alt>Down', '<Primary><Super>Tab', '<Control><Super>Tab']

    and the value of switch-to-workspace-up to

    ['<Control><Alt>Up', '<Primary><Super>BackSpace', '<Control><Super>Backspace']

  • This solution works more reliably than the solution I found with xbindkeys. The only drawback compared to xbindkeys is that the xbindkeys solution seemed to only capture the mouse key events, whereas this solution will also work if the keyboard keys are used. Regardless, the reliability of this solution makes it the better solution. – user223544 Dec 7 '14 at 21:12
2

So since the Microsoft Sculpt Comfort Mouse isn't registering mouse button presses for the super and swipe gestures, but instead is registering keyboard key presses, I used the 'xautomation' and 'xbindkeys' packages to listen for those key presses and send Ctrl+Alt+Right/Left to switch between workspaces. It's not an ideal solution, but it works like 8 out of 10 times.

#Move to left workspace
"xte 'keydown Control_L' 'keydown Alt_L' 'usleep 100' 'key Left' 'keyup Control_L' 'keyup Alt_L' 'keyup Left'"
   m:0x4+mod4+m:0x0+c:23
   #Control_L+Super_L+Tab

#Move to right workspace
"xte 'keydown Control_L' 'keydown Alt_L' 'usleep 100' 'key Right' 'keyup Control_L' 'keyup Alt_L' 'keyup Right'"
   m:0x4+mod4+m:0x0+c:22
   #Control_L+Super_L+Backspace

What this xbindkeys script does is it listens for the keypresses that the mouses swipe up and swipe down gestures send to the computer. If detected, xautomation sends the standard move desktop keystroke, control+alt+left/right.

The swipe up gesture on the mouse sends the keystroke of left control+left super+backspace. The swipe down gesture on the mouse sends the keystroke left control+left super+tab. m:0x4+mod4+m:0x0+c22 is the actual key code combination that gets detected by xbindkeys.

I'll mess with it a bit more to see if I can improve the efficiency, but for now this gets the job done. I just hope the tab and backspace that the mouse outputs don't screw with any work that I'm doing.

  • 1
    Can you explain how the solution works? Is the mouse sending Control_L+Super_L+Tab (Where are the Control_L+Super_L coming from)? Or do you match the mouse buttons with m:0x4+mod4+m:0x0+c:23 (You seemed to say that there are no mouse events generated in the question)? – Volker Siegel Aug 16 '14 at 22:12
  • I edited my solution to explain where Control_L+Super_L are coming from. I also explained the purpose of m:0x0+mod4+m:0x0+c:23. – user223544 Dec 7 '14 at 19:37
0

I wanted to map the same buttons to navigate through tabs in Firefox in both directions. I'm using xbindkeys and xmacro. It's working pretty well!

.xbindkeysrc

#Thumb down
"echo 'KeyStrPress Control_L KeyStrPress Tab KeyStrRelease Control_L KeyStrRelease Tab'|xmacroplay :0"
   Control+Mod4+Tab

#Thumb up
"echo 'KeyStrPress Control_L KeyStrPress Shift_L KeyStrPress ISO_Left_Tab KeyStrRelease Control_L KeyStrRelease Shift_L KeyStrRelease ISO_Left_Tab' |xmacroplay :0"
   Control+Mod4+BackSpace

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.