Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wox does not get focused on Alt+Tab #6

Open
lances101 opened this issue May 21, 2016 · 18 comments
Open

Wox does not get focused on Alt+Tab #6

lances101 opened this issue May 21, 2016 · 18 comments

Comments

@lances101
Copy link
Member

lances101 commented May 21, 2016

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
Copy link
Member

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
Copy link
Member Author

lances101 commented May 29, 2016

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
Copy link
Member

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
Copy link
Member Author

lances101 commented May 29, 2016

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 added a commit to Wox-launcher/Wox that referenced this issue May 29, 2016
@bao-qian
Copy link
Member

bao-qian commented May 29, 2016

@bao-qian
Copy link
Member

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

@lances101
Copy link
Member Author

@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
Copy link
Member

bao-qian commented May 31, 2016

  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
Copy link
Member

bao-qian commented Jun 2, 2016

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.

@lances101
Copy link
Member Author

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
Copy link
Member

bao-qian commented Jun 4, 2016

@lances101
could take a look about these questions?
#6 (comment)

@lances101
Copy link
Member Author

lances101 commented Jun 4, 2016

  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
Copy link
Member

bao-qian commented Jun 4, 2016

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

@lances101
Copy link
Member Author

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

@bao-qian
Copy link
Member

bao-qian commented Jun 4, 2016

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

@lances101
Copy link
Member Author

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

@lances101
Copy link
Member Author

e92367a seems to have fixed the issue. I've tested on several machines and it seems to work as expected now.

@lunxian
Copy link

lunxian commented Jul 5, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants