Remap side touch button on Microsoft Sculpt Comfort Mouse
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!
I just bought one myself and found that the following workes perfectly for me.
- Open dconf-editor (
sudo apt-get install dconf-editor
if it isn't already installed). - Navigate to org -> gnome -> desktop -> wm -> keybindings.
-
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']
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.