-
-
Notifications
You must be signed in to change notification settings - Fork 323
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
Can't use alt-tab shortcuts within virtualization apps #239
Comments
I recognized a similar issue using teamviewer or microsoft remote desktop. It feels like the key gets stucked. |
@gitgetgot side-note: you said you would prefer to have the app in English. I thought I could open a ticket to add a language dropdown in the preferences. Then I thought for a moment, and reflected on the fact that almost no app offers that choice, and they all reflect the OS language. You currently have you macOS in German. Why would you prefer having that 1 app in English? If you prefer English it seems like you would prefer English at the OS level too, no? That's my case for instance, I'm French but I have my laptops and phone set to English, and every app is thus in English. |
To recap, there seem to be an issue of the hold shortcut on:
It seems to be an interaction with virtualization / keyboard inputs forwarding to the remote systems. I don't have a remote machine to test this at the moment unfortunately. I'm thinking that it may reproduce in a VM hypervisor like VirtualBox or Parallel. I'll try testing with these apps. |
Thanks for looking into this @lwouis. Please let me/us know if you want more info, or something to get tested. |
I just tested with a Windows 10 VM in VirtualBox and I actually have the opposite issue: when having keyboard focus in the VM, I can type text inside Windows 10. However, when I press I think means that AltTab captures the shortcut before VirtualBox has a chance to do it.
Oh wait maybe I can try to remote desktop into the VM? Not sure if it's supported but it's worth a try |
@ngocphamm I use this very handy website to test inputs sent. Could you go there from the windows machine and press the main AltTab key (I think for you it's |
I was able to use TeamViewer to connect to the VM. However, I see the same behavior as I described above: every key goes to the VM correctly except Did you guys change some setting in TeamViewer? I can't reproduce |
@lwouis So I'm not able to reproduce the issue anymore it seems. I've not used AltTab in a while (because of the issue), though. This is what shows on that website on macOS. I hit And this is what shows on that website on the remote Windows machine (using RDP). I hit |
Seems like it works properly on macOS since the tab key doesn't show. I assume it's showing you AltTab UI at this point. Then on Windows, same thing? I assume it's doing the same as for me: you see the AltTab UI on top of the RDP window? |
Yup that's the behavior now @lwouis so it's working perfectly fine so far. I have updated the RDP app (Microsoft Remote Desktop Beta) multiple times since, so maybe it fixes itself 🤔 Or you actually fixed it. Thanks for working on this great app! |
@ngocphamm well I would say it's still not ideal that AltTab is showing instead of the remote windows alt-tab, but I would say that's a defect/limitation of the RDP apps since they should theotically find a way to intercept all inputs before any other app. It seems the way AltTab listens to keyboard events is higher priority somehow. I'm actually surprised because when you learn how this stuff works on macOS (spoiler: it's a terribly unmaintained/undocumented jungle, as usual from Apple), I would think that RDP app would use very low-level C APIs to get the events straight from the kernel instead of doing what I'm doing which is high-level. @gitgetgot @PLanB2008 can you guys give some feedback? I'm thinking about closing this ticket since the only action at this point would be on the RDP apps, not on AltTab side. |
@lwouis Yeah for me I can get around that limitation by setting AltTab to use Honestly I don't even care that much for the Windows one, because I use multiple monitors, and it's 2020 and Windows still can't figure out how to show that |
Also, sorry for asking this here because it's totally unrelated. I think I found a couple issues, but I don't really know how to take a screenshot of the window list (when I hit the shortcut). Do you know how @lwouis ? |
The way I do it is with macOS built-in Screenshot.app. I set a 5s timer, then I have 5s to prepare the scene by hitting the shortcut and other adjustment like which thumbnail is focused for example |
I have to look a littler deeper into this issue. I've to admit it didn't occur to me very recently. But this is also I result of not having to enter that many machines last week. I can test this a lot once I'm done with my programming tasks and back to supporting customers... I would suggest to wait a little more before closing the issue, maybe I can provide some more input during the week. |
I'm not sure, I could follow, but I tried my best... I am on MacOSX now, and exited AltTab. Here is what I get: This is the output from Safari Browser on MacOSX: Now, I started AltTab 3.12.0 Safari: From within VNC.app on Win7 machine: AltTab is still taking control over ALT+TAB inside Win7, I cannot use this combination to navigate thrugh the tabs. |
@gitgetgot thank you sharing your experimentation! Indeed, it seems like you, me, and @ngocphamm, all experience the same behavior. The behavior being that AltTab shortcut is always intercepted by AltTab first, whether on the host or on the remote window. I explained a bit of technical details above. In short I believe this is a limitations from the remote desktop apps. I don't see how AltTab could handle this. Think about this: AltTab want to grab keyboard before other apps. If an app on your mac has So AltTab grabs keys at a global level, before the apps. This includes the remote desktop apps it seems, according to our testing. I assumed they would have aggressive keyboard event listening, and grab before AltTab, but it seems they don't. I can't imagine something we can do at AltTab level to concede events to Remote desktop apps, but not to other apps. If you guys can envision how, please share :) |
Thanks for the explaination, the strange thing is, as I wrote in my initial post: My workflow was like this: Somehow its not working anymore and your explanation makes totally sense, although I don't understand, why it worked in the first place. |
@gitgetgot the behavior you describe was on 2.3.4? You sure about this exact version number? I will check how the keyboard code was back then, then |
I'm sure, because of the AltTab-2.3.4.zip on my harddrive which is dated 22.01.2020 and this version has no autoupdater, so I updated manually from a fresh downloaded AltTab-3.7.3.zip (12.04.2020) and that step seems not to be reversable (as I have no clue where the program stores its settings and what else I have to remove to really have a clean uninstall). |
The app has 2 things on the disk: the .app file, and the preferences. The preferences are handled by the OS. You can view them by typing this in Terminal: defaults read com.lwouis.alt-tab-macos and you can delete them by typing: defaults delete com.lwouis.alt-tab-macos Could you possibly try to delete the preferences, and run the 2.3.4 version on your machine, and share with us the exact behavior you experience in VNC.app? |
Oh my bad! I completely forgot that back in v2, preferences were stored in a custom JSON file! Sorry about the misinformation. You should be able to find it here: cat ~/Library/Preferences/alt-tab-macos.json and delete it with rm ~/Library/Preferences/alt-tab-macos.json |
@gitgetgot did you get a chance to re-try the old version and see what behavior you get inside VNC.app? |
Here is the list of apps users have reported, that can't use the in-VM
I would like to hear opinions on how we should handle these. Here are is the approach I can think of: When We could potentially make a better UX by only doing that if the window is fullscreen. Another option would be to detect if the focus is on the virtualized OS. That may or may not be possible using the Accessibility API, but I can tell already it would be specific to each app, and very hard to do. That may also be a preferences since some people may not use Also I'm wondering if we should do it for any shortcut, or only Note that I have done a POC locally, and disabling shortcuts when a specific app is active is working fine. It works for: VNC Viewer, Microsoft Remote Desktop, Team Viewer, VirtualBox. (I haven't tested Citrix apps yet). I'm mostly worried about the UX before going any further. |
For documentation purposes: it's possible to list current let n = 20
var list = [CGEventTapInformation].init(repeating: CGEventTapInformation(), count: n)
var count = UInt32.zero
CGGetEventTapList(n, &list, &count)
debugPrint(list) This can show event taps order (order in the array is the order in which they get a chance to see the events). From that list, the There is no way though to either change the order of other event taps. We can disable/re-enable to bump AltTab to the top/bottom of the list, but not bump only virtualization apps to get ahead. Even if we could, the UX is still not the best since users are trapped. I can't imagine a good UX that let's both users switch in the host and in the guest. I think, in fullscreen, everyone would prefer getting the guest |
I don't see a need to hard code the apps. Maybe there will be more in the future. Let the user decide how he wants AltTab to behave, which could be done with a simple blacklist. |
Could you elaborate on the UI to update such a blacklist? Some issues I can imagine off the top of my head:
I'm not sure that's technically possible. It depends if the virtualization app sends a new event to the system when the |
I thought I have read that you wanted opinions. I could have explained the idea of an blacklist a bit better, but I guess you already wrote how it could look like
Actually quite a good idea. macOS does the same i.e. when creating keyboard shortcuts for apps.
Good idea to be honest. Exactly what I thought of.
Uhm, yes?
Ok, this might depend on the app. But usually if I am trapped within an vm it doesn't even care about AltTab. As soon as I use the host key, I can make AltTab appear again because now I am working on the macOS level again. Just gave it a quick try in Parallels. Within my VM (Windows, not full screen) I can use cmd-tab or alt-tab perfectly fine. If I press ctrl+alt it sets me free and cmd-tab and alt-tab behave on mac os level again. EDIT: So actually AltTab works like you described already. Except there is no blacklist needed because the cursor is properly trapped by Parallels already. |
I think that's because you started Parallel after AltTab which put it at the head of the event taps list, which means it gets to intercept events first. Could you try launching AltTab after Parallel, and see if it works the way you describe, still? |
Actually, I just tried playing with the starting order on my machine, and also changing the @skupfer I don't understand how you got Parallel to display Windows's |
@lwouis You are right. I started AltTab -> Parallels. Parallels Tools are installed, too (if this makes a difference). If I first start Parallels it behaves like you say. It was late when I tried and didn't pay enough attention to the starting order. But just right now I noticed if I am in a terminal in iTerm, AltTab doesn't work. It just sends a Tab to the terminal window. (AltTab started after or before iTerm, same). |
I tried with iTerm but can't reproduce: AltTab shows properly. You're saying that if you switch to iTerm, if sends just tab to the terminal? What if you switch back to another app, then it works? I can't imagine what's going on here |
This is weird. So yes, if I AltTab to iTerm, it just sends a tab to the terminal if I try to AltTab again. If I switch to another app (cmd tab or swipe left/right) it works again. How can I help you finding out what's wrong? Any debug logs or whatever I can send you? |
Yes, but unfortunately, I couldn't reproduce the bebaviour I described in my initial post. after removing
and setting the options to my needs, I can not navigate via alt-tab inside VNC.app End of story. :-( |
I used to use VMWare Fusion and if I was trapped inside Windows in fullscreen, I could simply quickly press two times CTRL or something like that which unfocussed VMWare. I found this very easy to remember and very useful. Also, that function did not "waste" a real shortcut. |
Again, it's all about who reads the keyboard first. If AltTab gets to read the 2 If it decides to pass-through to macOS, it should pass it to, in order:
|
@gitgetgot we discussed a UI that lets the user select |
I would like to ask people interested in this issue for their opinion 🗳️ I revisited all discussion in this ticket, and I believe the solution I outlined here is the best way forwards. It offers an out-of-the-box good experience with virtualization apps. Here are the core features:
I think it solves most real-world use-cases. We could also add, potentially in a second drop, a UI to manage the blacklist. We keep the default hardcoded common virtualization apps, but we let people update the list. What I really don't like with this idea, is that a lot of people will get confused thinking that this blacklist is about blocking which app have their windows listed in AltTab. Clarifying that without a wall of text seems difficult to me. Please let me know if you agree with this path forward, then I'll probably implement it soon as it's not much effort to do, without the blacklist UI. |
I've been working hard to find a solution for this ticket, but it's really complex. I started hardcoding this list of bundleIds, tested locally:
Then I searched and found other people's lists and it gets more complex. Then I realize that some people may actually want AltTab to switch them from 2 fullscreen VMs for example, thus we shouldn't hardcode it. So I explored the idea of the blacklist again. I thought I should add a new tab in the Preferences called "Blacklist". Inside we could have a list of apps, and maybe checkboxes next to each row: "Ignore AltTab's shortcuts while this app is focused" and "Don't list this app's windows in AltTab". But I started asking myself what this list would consist of. It can't be private func androidEmulator(_ runningApp: NSRunningApplication, _ title: String?) -> Bool {
// android emulator small vertical menu is a "window" with empty title; we exclude it
if title != "",
// NSRunningApplication provides no way to identify the emulator; we pattern match on its KERN_PROCARGS
runningApp.bundleIdentifier == nil,
let executablePath = Sysctl.run([CTL_KERN, KERN_PROCARGS, runningApp.processIdentifier]) {
// example path: ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64
return executablePath.range(of: "qemu-system[^/]*$", options: .regularExpression, range: nil, locale: nil) != nil
}
return false
} As you can see, the Android Emulator is a weird case because the app has no There are endless corner-cases. At the end of the day, I think I will go for this UI as a first pragmatic pass. It can be improved later, but this would improve the situation for most users, for reasonable dev effort: |
# [4.5.0](v4.4.0...v4.5.0) (2020-07-17) ### Bug Fixes * alt-tab preferences panel was sometimes not listed ([e25716b](e25716b)) * launch crash on macOS versions < 10.15 ([d817545](d817545)) ### Features * allow backlisting apps, with 2 different types of blacklist ([d32951f](d32951f)), closes [#239](#239)
@skupfer Turn off iTerm2`s Secure Keyboard Entry |
Hi and thank you for the long missed, and imho more intuituve than MacOSX standard behaviour!
I have used the "old" v2.3.4 a long time with Mojave and it worked pretty flawlessly.
I'm using VNC.app a lot, connecting to a Win7 Machine.
With the old version I could just normal "move around" inside the VNC window and control it via keyboard shortcuts, although the ALT-TAB is bound in AltTap.app to the same keys as in Win7.
Never had a problem navigating inside the Win7 Windows via ALT-TAB keys
With the new version all the keys are mixed up in Win7 Window of VNC.app.
(all keys, like 123... or abc...z not just only the control keys)
It seems to me, that the ALT Key is locked, like the CAPS-LOCK function.
(i.e. If I press ENTER in explorer.exe on a file, it opens its Properties instead of opening the file.)
When I quit AltTab.app, everything works fine....
So.... I thought, I could be clever and re-install the old version, but unfortunately, that trick did not work. Same creepy behaviour, also, I have the impression, some options from the preferences window are missing...they look strange to me...but that could only be my impression.
I'm sorry, I did not made a screenshot of my prefs from the old version, but the new one looks like this:
(sorry for german language screenshots, did not find a way to swtich to english, which I would also prefer.)
So, the question is, and before I talk about a feature request to turn off AltTab.app on special apps when on focus, I like to ask, if this is a known issue (found no open tickets) and how could I possible get this fixed? It worked great with v2.3.4
Thanks again for the great tool!
EDIT: I could make a video, but you don't see what keys I press, so its pretty useless, IMHO.
The text was updated successfully, but these errors were encountered: