Wox-launcher / Wox.Plugin.Switcheroo

The humble incremental-search task switcher for Wox
29 stars 6 forks source link

Wox does not get focused on Alt+Tab #6

Open lances101 opened 8 years ago

lances101 commented 8 years ago

As of 1.0.6, still, while the Alt+Tab hotkey is overriden and Wox is shown, the focus is not on Wox's input field.

bao-qian commented 8 years ago

try 1.3.109 https://ci.appveyor.com/project/happlebao/wox/build/1.3.109 hotkey has been rewrite. you cann assign alt+tab in hotkey tab in settings.

lances101 commented 8 years ago

I will test more extensively this week on a real Windows installation.

So far, in the VM when I set the hotkey to Alt+Tab it reacts to the first one correctly, but sequential presses of tab get recognized as Alt+Tab. Cannot confirm if this is a VM issue or not at this point.

bao-qian commented 8 years ago

but sequential presses of tab get recognized as Alt+Tab.

could you try 1.3.103 to test this problem? https://ci.appveyor.com/project/happlebao/wox/build/1.3.103/artifacts

lances101 commented 8 years ago

1.3.103 has the same issue as all the versions before 109: on pressing Alt+Tab Wox is shown, but does not get focused.

bao-qian commented 8 years ago

how about 114...? https://ci.appveyor.com/project/happlebao/wox/build/1.3.114

bao-qian commented 8 years ago

do you have this problem in release version v1.3.67 ?

lances101 commented 8 years ago

@happlebao Builds 114, 122 have the same issue. Wox is shown, but not focused.

In build 1.3.67 upon launching Wox with the hotkey set to Alt+Tab I'm notified that the hotkey could not be set. If build 1.3.67 is using NHotkey to register the Alt+Tab hotkey it will not work, because NHotkey tries to register a new system-wide hotkey and not adding a hook to the chain of calls.

bao-qian commented 8 years ago
  1. what I mean is use 1.3.67 with replace alt+tab option in switcheroo plugin option. could you get focus?
  2. and if you use above setting and 1.3.67. will this line be called?
  3. if you use 1.3.67 and alt+tab can't get focus, will win+r (shell plugin) get focus ?
bao-qian commented 8 years ago

methods to register/hook alt+tab

[HKEY_CURRENT_USER\Control Panel\Desktop]
"CoolSwitch"="0"

how other applications doing


I can't find any working method or working application now. let me know if you have more ideas.

lances101 commented 8 years ago

Sorry for the delays between answers, I am a little busy with finals.

I think the way to go is to keep using the low-level hook, but also add the functionality to be able to focus the Wox window also on a low-level. What do you think?

Also, on a separate topic, I recently found GoToWindow and I think Switcheroo could be eventually replaced by it. While both projects (Switcheroo&GotoWindow) are not in active development, GoToWindow has some interesting functionality (as jumping to specific browser tabs).

bao-qian commented 8 years ago

@lances101 could take a look about these questions? https://github.com/Wox-launcher/Wox.Plugin.Switcheroo/issues/6#issuecomment-222807608

lances101 commented 8 years ago
  1. With 1.3.67 when I enable the Switcheroo setting I still get no focus in most cases. A weird thing that does happen is that after attaching the debugger the bug seems to be "fixed" and Wox is always focused.
  2. It is not called. state.AltPressed returns false even though it's true. I cannot debug it with a debugger, because once I attach it always fires correctly.
  3. Win+R is detected just fine

Edit: Added some simple logging to see what is actually happening since I can't debug it.

2016-06-04 18:57:28.3590|INFO|Wox.Plugin.Switcheroo.Plugin.API_GlobalKeyboardEvent|EVENT KE-260, VK-9, Alt-True
2016-06-04 18:57:28.3590|INFO|Wox.Plugin.Switcheroo.Plugin.API_GlobalKeyboardEvent|Key down handled, should exit.
2016-06-04 18:57:28.3719|INFO|Wox.Plugin.Switcheroo.Plugin.API_GlobalKeyboardEvent|EVENT KE-261, VK-9, Alt-True
2016-06-04 18:57:28.3719|INFO|Wox.Plugin.Switcheroo.Plugin.API_GlobalKeyboardEvent|Key up handled, should exit.
2016-06-04 18:57:28.9750|INFO|Wox.Plugin.Switcheroo.Plugin.API_GlobalKeyboardEvent|EVENT KE-257, VK-164, Alt-True
2016-06-04 18:57:28.9750|INFO|Wox.Plugin.Switcheroo.Plugin.API_GlobalKeyboardEvent|We are letting ALT  tab pass - KE-257, VK-164, Alt-True 

The key_up (260) and key_down (261) events are watched and the function returns false, but then it fires once more and returns true.

bao-qian commented 8 years ago

could you get focus when using switcheroo (alt tab enabled)?

lances101 commented 8 years ago

All of what I said in my last comment is related to 1.3.67 with Alt+Tab in Switcheroo enabled.

bao-qian commented 8 years ago

I know. But is switcheroo is working, we can just copy their code ....

lances101 commented 8 years ago

I took a look at their code now. It seems like they had the same problem. Take a look at the comment here

lances101 commented 8 years ago

https://github.com/Wox-launcher/Wox.Plugin.Switcheroo/commit/e92367a3005abdeff43f380c1ab7a59d5cd1063a seems to have fixed the issue. I've tested on several machines and it seems to work as expected now.

lunxian commented 8 years ago

I tested 1.0.7, alt+tab did not work for me. Windows 10 10586 X64