0

Is it somehow possible to add a 3-finger swipe gesture on a system scale, like a hotkey ? Yes, just like the notification center gesture, only from the other side. (sandboxed)

Maybe by using a Desktop-size overlay window that is transparent and captures swipe gestures ?

cocoa coder
  • 214
  • 1
  • 3
  • 15

2 Answers2

2

Create a gesture recognizer and use setNumberOfTouchesRequired = 3

pasawaya
  • 11,515
  • 7
  • 53
  • 92
Ramy Kfoury
  • 937
  • 5
  • 8
2

If you were to use a transparent, desktop-sized overlay window, CocoaNavigationGestures on Github may be of use for code on getting left and right swipes on both Leopard and Lion.

Seb Jachec
  • 3,003
  • 2
  • 30
  • 56
  • THX. Now if the overlay would have ignoremouseclicks set to true but [self setAcceptTouchEvents:YES];, would you think it could work then ? Also, there seems to be already a 3-finger swipe build-in into cocoa to use: http://stackoverflow.com/questions/6747603/how-to-implement-the-two-finger-swipe-gesture-in-cocoa-to-go-back-and-forward/6748111#6748111. Would you rather recommend to use this or CocoaNavigationGestures ? – cocoa coder Nov 03 '12 at 12:15
  • 1
    I'd give the CocoaNavigationGestures sample code a go. It believe it works with both two and three finger swipes, depending on user settings in System Preferences and is compatible with both Leopard and Lion/ML. I believe if you have `setAcceptTouchEvents:YES` it should be fine. – Seb Jachec Nov 03 '12 at 12:27
  • As you may know the Notification Center has a special gesture: 2 finger swipe from the right edge of the trackpad. I don't see how such a truly custom swipe gesture (from the edge) is possible with CocoaNavigationGestures, or what do you think? – cocoa coder Nov 03 '12 at 14:00
  • I've tried it and can do a gesture just like Notification Center's, but from the other side, just fine. – Seb Jachec Nov 03 '12 at 14:19
  • Wow, and it only toggles when swiped from the edge? (sorry, can't try it out myself at the moment) – cocoa coder Nov 03 '12 at 14:40
  • It doesn't toggle when *only* swiped from the edge, but it could surely be made to. – Seb Jachec Nov 03 '12 at 15:48
  • Mh .. unfortunately the gesture only works when the overlay window is key and when the overlay is key it "swallows" all gestures and won't let other gestures (like 2 finger right or left) which might be needed by other apps pass through. – cocoa coder Nov 06 '12 at 13:16