Wox.Plugin.Switcheroo icon indicating copy to clipboard operation
Wox.Plugin.Switcheroo copied to clipboard

Wox does not get focused on Alt+Tab

Open lances101 opened this issue 9 years ago • 18 comments
trafficstars

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.

lances101 avatar May 21 '16 23:05 lances101

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.

bao-qian avatar May 29 '16 20:05 bao-qian

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.

lances101 avatar May 29 '16 21:05 lances101

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

bao-qian avatar May 29 '16 21:05 bao-qian

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.

lances101 avatar May 29 '16 21:05 lances101

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

bao-qian avatar May 29 '16 23:05 bao-qian

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

bao-qian avatar May 30 '16 11:05 bao-qian

@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.

lances101 avatar May 31 '16 09:05 lances101

  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 avatar May 31 '16 20:05 bao-qian

methods to register/hook alt+tab

  • lowlevelkeyboardhook:
    • won't get focus if start menu is open
    • won't be called at all if task manager is focused (can be fixed by run as admin)
  • RegisterHotkey: MS claims that we can register alt+tab from XP. as seen here. but this not working in win10, even run as admin.
  • disable it in registry: the following entry is not showing in win10, and it has no effect if I add it manually
[HKEY_CURRENT_USER\Control Panel\Desktop]
"CoolSwitch"="0"

how other applications doing

  • switcheroo is using lowlevelkeyboardhook for alt+tab, because this hotkey won't working if task manager is focused
  • vistaswitcher is not working from win8, so I guess it use RegisterHotkey

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

bao-qian avatar Jun 02 '16 21:06 bao-qian

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).

lances101 avatar Jun 04 '16 15:06 lances101

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

bao-qian avatar Jun 04 '16 15:06 bao-qian

  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.

lances101 avatar Jun 04 '16 16:06 lances101

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

bao-qian avatar Jun 04 '16 17:06 bao-qian

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

lances101 avatar Jun 04 '16 17:06 lances101

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

bao-qian avatar Jun 04 '16 17:06 bao-qian

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

lances101 avatar Jun 04 '16 17:06 lances101

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.

lances101 avatar Jun 23 '16 19:06 lances101

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

lunxian avatar Jul 05 '16 09:07 lunxian