MacGesture / MacGesture

Global mouse gestures for macOS
https://github.com/MacGesture/MacGesture/wiki
GNU General Public License v3.0
808 stars 95 forks source link

Not switching MissionControl space #60

Closed ww7 closed 7 years ago

ww7 commented 7 years ago

I try to create gesture for switching spaces, but this not work with MacGesture

Sierra 10.12.3

jiegec commented 7 years ago

Hum, more details? Like screenshots?

ww7 commented 7 years ago

Just try to assign gesture to moving ←→ between spaces Keyboard Shortcut works, gesture not If this bug is complicated, I use Applescript

Updates is planned soon?

jiegec commented 7 years ago

Preparing for College Entrance Examination these days. When you assign the gesture, please disable the binding first in System Preferences, and reassign that after updating the settings in MacGesture.

dss886 commented 7 years ago

@jiegec 我也遇到了这个问题,明明已经成功绑定快捷键: I also met this issue. I have bind the shortcut successfully: 1

在执行手势的时候能成功识别,但是却不切换,扬声器里出现了“咚”的一声: But it doesn't do the task when success to recognize my gesture, with an warning beep in the speakers: 2

另,高考为重,好好复习

jiegec commented 7 years ago

谢谢祝福。我已经发现问题所在,但还没有一个可行的解决方案。周末再仔细研究

dss886 commented 7 years ago

@jiegec 我现在和@ww7 的解决方案一样,用AppleScript来发送快捷键,很完美。 如果这个解决起来很麻烦的话,暂时不管貌似也没什么问题。

@jiegec Now my solution is same as @ww7 that using an AppleScript to perform the shortcut and it is perfect. if the bug is very complicated, it seems to be ok without fix it.

tell application "System Events"
    key code 123 using {control down}
end tell
tell application "System Events"
    key code 124 using {control down}
end tell
jiegec commented 7 years ago

可以试试这个版本吗:链接: https://pan.baidu.com/s/1slIwuQx 密码: w445 在代码里改动了一点点:

  static inline void pressKeyWithFlags(CGKeyCode virtualKey, CGEventFlags flags) {
 -    CGEventRef event = CGEventCreateKeyboardEvent(NULL, virtualKey, true);
 +    // Fix issue #36. Dunno why it sends Control+Up as Fn+Control+Up. Invert the behavior.
 +    if (flags == kCGEventFlagMaskControl) {
 +        flags ^= kCGEventFlagMaskSecondaryFn;
 +    }
 +    CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
 +    CGEventRef event = CGEventCreateKeyboardEvent(source, virtualKey, true);
      CGEventSetFlags(event, flags);
 -    CGEventPost(kCGSessionEventTap, event);
 +    CGEventPost(kCGHIDEventTap, event);
      CFRelease(event);

 -    event = CGEventCreateKeyboardEvent(NULL, virtualKey, false);
 +    event = CGEventCreateKeyboardEvent(source, virtualKey, false);
      CGEventSetFlags(event, flags);
 -    CGEventPost(kCGSessionEventTap, event);
 +    CGEventPost(kCGHIDEventTap, event);
      CFRelease(event);
  }
dss886 commented 7 years ago

@jiegec 这个版本所有功能都是失效的……

2017-04-15 11 40 17

dss886 commented 7 years ago

另外,我用AppleScript触发快捷键移动space的方法,在10.12.3上可用, 但升级成10.12.4后失效,12.4暂时没找到可行的方法控制Mission Control…… 三台机器均重现了,所以我重装了一下系统降级到10.12.3了

jiegec commented 7 years ago

10.12.4下我也试过AppleScript方法,也有问题,发出去的按键也不只是control。觉得Apple在搞事,不给我们好好发按键。 所有的功能都是失效的啥意思?

dss886 commented 7 years ago

就是像我截图里的这样,都是灰色的,其它功能也都不正常了

jiegec commented 7 years ago

奇怪。。灰色一般是表示disable了。这个功能是双击时切换enable/disable。

jiegec commented 7 years ago

。我似乎忘记把enable改成default了。

jiegec commented 7 years ago

试试这个:链接: https://pan.baidu.com/s/1o8bPX4Q 密码: cetz

ww7 commented 7 years ago

@dss886 Try solution with change arrow keys (key code 123 and 124) for example to 9 and 0 keys (key code 29 and 25). [, ] — also works Don't forget to set in System Preference / Keyboard Shortcuts osx 10.12.4

dss886 commented 7 years ago

@jiegec 网盘的这个fix2还是不行……用ww7改成control+数字的的办法可以。。。目测是10.12.4以上箭头的事件改了

@ww7 your are awesome...control+number keys works, thx

macOS 10.12.5

jiegec commented 7 years ago

也许是macOS在箭头上做了保护啥的。。坑

jiegec commented 7 years ago

Documented and fixed in commit f2ece6f and 8239c13

kostazzz commented 1 year ago

Hey, somebody help me please, I'm not a programmer is it possible to configure switching between spaces? I still don't understand what to do? I can't figure out how to apply the dss886 Applet script. I will be grateful for any help.