Fluor icon indicating copy to clipboard operation
Fluor copied to clipboard

iTerm2 Hotkey Window support

Open smaugfm opened this issue 3 years ago • 0 comments

Hey, I just discovered your app and it is amazing! However, I use iTerm2 as my terminal and particulary its built-in drop-down-always-on-top-sliding-window feature (which makes iTerm2 to behave like the famous Guake terminal for GNOME).

The problem is that when the hotkey is pressed and iTerm2 window slides out it doesn't actually activate iTerm2 application as a foreground application and Fluor doesn't change mode.

Currently, I am thinking of a workaround to this. But is there any chance you might work on this issue? I believe a different API must be used by Fluor to detect such "floating" windows. I am not familiar with macOS development myself, but I found this code in iTerm2 project which selects what level must this sliding window be: windowLevelJustBelowNotificiations = NSMainMenuWindowLevel - 2;

UPD: I've implemented the necessary changes myself. Here it is: https://github.com/smaug-fm/Fluor. I only added support for iTerm2 specifically, but I can try to generalize the solution to support any app.

In short, iTerm2 uses a window with NWindowLevel not equal to 0 and when this window catches focus it does not activate iTerm2 app. So I've added an AXObserverAddNotification notification to listen for kAXFocusedWindowChangedNotification. But unfortunately, the notification only works when the window catches focus, but not when it loses it. Unfortunately, it's forced me to add polling for lost focus.

smaugfm avatar Sep 06 '22 17:09 smaugfm