numist / Switch

A window-based context switcher for the Mac
157 stars 17 forks source link

Terminal.app versus global shortcut #129

Open gcbw opened 8 years ago

gcbw commented 8 years ago

When i press the Option+tab shortcut and the focus is currently on a Terminal.app window, the terminal app just behave as if i had pressed Tab without any modifier.

I already entered the Terminal settings and deleted all the keyboard modifiers that include either Option or Tab.

numist commented 8 years ago

@gcbw: This seems like it might be a problem with the first-run flow. There is supposed to be a dialog that prompts you to turn on accessibility so Switch's hotkeys and window switching will work, but it often gets hidden under other windows.

If you go to System Preferences → Security and Privacy → Accessibility, does Switch have access to control the computer (is the box checked)?

gcbw commented 8 years ago

@numist i did that. The flow worked out just fine. In fact, better than other switchers.

it works everywhere, except Terminal.app

i am using iTerm2 now to work around

gcbw commented 8 years ago

I just noticed several other things here... only show apps from one screen and most settings are disabled (updates, everything in the hotkeys tab). is this expected or do i have a botched build and am just wasting everyones time?

numist commented 8 years ago

How strange, I wasn't able to reproduce on my MBA11 running 10.11.3. Does the Switch log (-click on the Switch status bar item to get to the log folder) say anything different when you try to use the hotkey when focused on Terminal vs when it's working normally?

If there's no obvious smoking gun in the log, could you could send your system information (from System Information.app), a copy of com.apple.Terminal.plist (from ~/Library/Preferences), and the Switch log to dev@numist.net?

In terms of the preferences, it's been a long time since a release (I'm working full time writing software again, which cuts into software as a hobby), but the version on the develop branch only has disabled:

My memory is a bit unreliable, but I think the last released version (0.0.8β) had the same level of active features, most of the changes since then have been performance and stability related.

gcbw commented 8 years ago

ok so the prefs disabled are fine. i'm struggling with rake/rvm here to try to get a decent build from source.

here is the log. after i raise Terminal, nothing shows up on the logs. And nothing happens anyway...

logs show my session with 3 windows. iTerm2, Terminal, Finder.

2016-04-08 13:56:03.145 Switch[1310:10079] SWAppDelegate.m:35 Launched Switch 0.0.8 (β)
2016-04-08 13:56:07.853 Switch[1310:10079] SWCoreWindowService.m:162 Switch is active (0.000s elapsed)
2016-04-08 13:56:07.857 Switch[1310:10079] SWCoreWindowService.m:377 Window list loaded with 3 windows (0.004s elapsed)
2016-04-08 13:56:07.857 Switch[1310:10079] SWCoreWindowService.m:383 Index does not need adjustment (0.004s elapsed)
2016-04-08 13:56:08.005 Switch[1310:10079] SWCoreWindowService.m:472 Display timer fired 0.001s late (0.151s elapsed)
2016-04-08 13:56:09.716 Switch[1310:10079] SWCoreWindowService.m:589 Dismissed (1.863s elapsed)
2016-04-08 13:56:09.747 Switch[1310:10083] SWAccessibilityService.m:182 Raising iTerm2 window 0x7facd1749800 <72 (1. sh)> took 0.001s
2016-04-08 13:56:10.757 Switch[1310:10079] SWCoreWindowService.m:162 Switch is active (0.000s elapsed)
2016-04-08 13:56:10.762 Switch[1310:10079] SWCoreWindowService.m:377 Window list loaded with 3 windows (0.005s elapsed)
2016-04-08 13:56:10.762 Switch[1310:10079] SWCoreWindowService.m:383 Index does not need adjustment (0.005s elapsed)
2016-04-08 13:56:10.907 Switch[1310:10079] SWCoreWindowService.m:472 Display timer fired 0.000s late (0.150s elapsed)
2016-04-08 13:56:12.188 Switch[1310:10079] SWCoreWindowService.m:589 Dismissed (1.432s elapsed)
2016-04-08 13:56:12.207 Switch[1310:10121] SWAccessibilityService.m:182 Raising Finder window 0x7facd17408b0 <84 (/Users/gbarros/Library/Logs/Switch)> took 0.001s
2016-04-08 13:56:12.741 Switch[1310:10079] SWCoreWindowService.m:162 Switch is active (0.000s elapsed)
2016-04-08 13:56:12.744 Switch[1310:10079] SWCoreWindowService.m:377 Window list loaded with 3 windows (0.003s elapsed)
2016-04-08 13:56:12.745 Switch[1310:10079] SWCoreWindowService.m:383 Index does not need adjustment (0.004s elapsed)
2016-04-08 13:56:12.892 Switch[1310:10079] SWCoreWindowService.m:472 Display timer fired 0.000s late (0.150s elapsed)
2016-04-08 13:56:13.548 Switch[1310:10079] SWCoreWindowService.m:589 Dismissed (0.807s elapsed)
2016-04-08 13:56:13.566 Switch[1310:10098] SWAccessibilityService.m:182 Raising Terminal window 0x7facd16e1ea0 <82 (Terminal)> took 0.001s
2016-04-08 13:56:31.012 Switch[1310:10079] SWCoreWindowService.m:162 Switch is active (0.000s elapsed)
2016-04-08 13:56:31.016 Switch[1310:10079] SWCoreWindowService.m:377 Window list loaded with 4 windows (0.004s elapsed)
2016-04-08 13:56:31.016 Switch[1310:10079] SWCoreWindowService.m:383 Index does not need adjustment (0.004s elapsed)
gcbw commented 8 years ago

managed to (barely) build it, but have zero familiarity with xcode... i can only bind the intermediate frameworks in my build dir...

xcode builds without any issue. just show a toaster "build successful" but i can't find a binary anywhere. And rake app fails with:

❌ error: There is no SDK with the name or path '/Users/gbarros/code/Switch/Frameworks/Sparkle/macosx10.9'

numist commented 8 years ago

Bad news, my fork of Sparkle broke when OS X was released. Good news, the project is actively maintained again so I don't have to maintain it anymore!

Pushed 058c799ec2cff59d0d8b4590bb05e6e5e65c9776 to develop, you'll need to run rake dep first and then rake app should work.

gcbw commented 8 years ago

silly question, what is the correct setup to run rake deps and install the gems in the repo path, not globally (which requires sudo in standard ruby mac osx install). Do you just install everything for all projects globally?

gcbw commented 8 years ago

needed this to build on that revision

+++ b/Switch.xcodeproj/project.pbxproj
@@ -1334,6 +1334,7 @@
                CLANG_CXX_LIBRARY = "libc++";
                CLANG_ENABLE_MODULES = NO;
                CLANG_ENABLE_OBJC_ARC = YES;
+               CLANG_ENABLE_OBJC_WEAK = YES;
                CLANG_WARN_CONSTANT_CONVERSION = YES;
                CLANG_WARN_EMPTY_BODY = YES;
                CLANG_WARN_ENUM_CONVERSION = YES;
@@ -1373,6 +1374,7 @@
                CLANG_CXX_LIBRARY = "libc++";
                CLANG_ENABLE_MODULES = NO;
                CLANG_ENABLE_OBJC_ARC = YES;
+               CLANG_ENABLE_OBJC_WEAK = YES;
                CLANG_WARN_CONSTANT_CONVERSION = YES;
                CLANG_WARN_EMPTY_BODY = YES;
                CLANG_WARN_ENUM_CONVERSION = YES;
numist commented 8 years ago

I don't have many projects that use Ruby; the dependencies are installed globally (for that version of ruby, via rvm) on my machine.

Interesting that CLANG_ENABLE_OBJC_WEAK needs to be set specifically; I would have expected it to be enabled by default on the latest version of Xcode?

numist commented 8 years ago

A lot of Switch's dependencies broke compatibility while I was looking away. Top of tree develop should work reliably now. If you're using rvm then it will select the right userspace ruby and install gems local to that version :)

numist commented 8 years ago

Any improvement in 0.0.10?

gcbw commented 8 years ago

taking me forever to compile... not familiar with either rake/git external references (rake deps always fails if the base repo is not a clean clone of this) nor xcode's random files diffs...

anyway, tested a clean build of .10b from a clean checkout, and i still get the same results.

numist commented 8 years ago

Maybe I can reproduce this with more information about your configuration; can you share a sysdiagnose?

gcbw commented 8 years ago

i tried disabling every keyboard shortcut option on Terminal.app, and i also disabled karabiner. Nothing changed. Also, i noticed that the hijack of option+tab does not happen only on the terminal itself, but on it's setting windows!

also, here is what i "type" on terminal.app when i press option+tab with or without Switch running:

 $ hexdump x
0000000 1b 09                                          
0000002

TAB ESC. weird.

vanrijn commented 7 years ago

Weird. I can't reproduce this. I'm running 10.11.6 (15G1004) and ToT from the develop branch. Option+Tab works fine with Terminal for me. =:/

ghost commented 7 years ago

Could it be related to Use Option as meta key?

gcbw commented 7 years ago

@megadr01d good find, but i don't think it plays anything here. I always had that off (vim ftw!). I just tested now and it doesn't change anything. Terminal.app hijacks the key combo with that setting on or off.

I ditched terminal.app because of this. I use iTerm2 exclusively now when i am forced to use a mac.

numist commented 7 years ago

i tried disabling every keyboard shortcut option on Terminal.app, and i also disabled karabiner. Nothing changed. Also, i noticed that the hijack of option+tab does not happen only on the terminal itself, but on it's setting windows!

also, here is what i "type" on terminal.app when i press option+tab with or without Switch running:

 $ hexdump x
0000000 1b 09                                          
0000002

TAB ESC. weird.

Those are the keystrokes I'd expect to see delivered to Terminal if Switch weren't running. I wonder if Terminal's "Use Option as Meta key" setting is implemented in such a way that obscures Switch's use of OPT.