DEV Community

Cover image for How to use a non-mac mouse to move between spaces and open Mission Control on MacOS
Robert Hustead
Robert Hustead

Posted on

How to use a non-mac mouse to move between spaces and open Mission Control on MacOS

TL;DR Just follow these steps, full explanation will follow.

1) Download and install "MacGesture" using homebrew with
brew install --cask macgesture

2) In "Preferences", navigate to the AppleScript tab.

AppleScript example image
3) Click the "+" button to create 3 new AppleScripts, giving them the following names and scripts:
a) Navigate Left: tell application "System Events" to key code 123 using control down
b) Navigate Right: tell application "System Events" to key code 124 using control down
c) Open Mission Control: tell application "System Events" to key code 126 using control down

4) Navigate to the "Gestures" tab, and delete any gestures that might exist. Add 3 new Gestures, selecting "Add a AppleScript Rule" when prompted by clicking the "+" button.

Gesture example image
5) Give these new Gestures the following properties. Yes, I really do mean give Gesture Left the Navigate Right action, etc.
a) Gesture: L, Filter *, Action: Navigate Right, Note: [Whatever you want, not necessary], Lightening Bolt: [Unchecked]
b) Gesture: R, Filter *, Action: Navigate Left, Note: [Whatever you want, not necessary], Lightening Bolt: [Unchecked]
c) Gesture: U, Filter *, Action: Open Mission Control, Note: [Whatever you want, not necessary], Lightening Bolt: [Unchecked]

6) Adjust any other General settings you want.

Finished. You can now hold down the right mouse button, flick the mouse to the left, and it will slide your current Screen to the right. Same with the opposite. Holding right mouse button and flicking up will open Mission Control. Have fun!


Fuller Explanation that I expect no one to read

I have a Mac I use for work, and while I love all the 'gestures' you can do with the track pad, mine recently blew up and I needed to go back to my boring windows style mouse. However, I really like being able to scroll between different Desktops (called Spaces I guess?). I want to keep that functionality, but I wanted to be able to do it with my mouse and not a track pad.

I found the app mentioned above, and I tried making a custom gesture to be able to hold down the right mouse button, and flick the screen to the left or right. I knew you could hold down CONTROL and press RIGHT or LEFT on the keyboard and it would switch Spaces, so I wanted to do the same but have my mouse's right button be CONTROL, and then it's movement be the LEFT or RIGHT. My problem was, whenever I tried to key in the macro for MacGesture, it wouldn't register CONTROL as part of the macro.

AppleScript to the rescue! Now, I set the custom macro to be a LEFT or RIGHT (or UP) movement while also holding down the CONTROL key, and I map them to basic Gesture "L" for left and "R" for right, setting them to run during any and all applications (the "*" in Filter)

This took me longer than I want to admit to figure out, and every other explanation I found online has huge wordy explanations or a long Youtube video that no one wants to watch. So hopefully this quick tutorial helps you out and you can get back to coding. Good luck!

Top comments (2)

Collapse
 
roshan_sharma_7deae5e0742 profile image
roshan sharma

Yeah, you can totally do that. Here’s how:

  1. Go to System Settings > Mouse.
  2. Check if your mouse supports extra buttons (like back/forward or middle click).
  3. If it doesn’t, install something like BetterTouchTool or SteerMouse, those let you map any button or scroll gesture to actions.
  4. In BetterTouchTool, set one action to “Mission Control” and another to “Move left/right a space.” That’s it, works like a charm once you set the gestures.
Collapse
 
priteshkiri profile image
Pritesh Kiri

This is a helpful guide!! Thanks for sharing