rickgbw / hyperterm-overlay

A complete and customizable solution for a overlay window in your Hyper.app
MIT License
131 stars 20 forks source link

Win - focus is not switching back to previous application #38

Open peterdanis opened 7 years ago

peterdanis commented 7 years ago

Hi, in Windows focus is not switching back to previous application after hiding hyper with hyperterm-overlay. No window is focused.

Tried with animation true/false, with vanilla hyper+hyperterm-overlay. Tested on Windows 7 and Windows 10. On Linux it works fine.

simonhaenisch commented 6 years ago

Did you actually try to enable hide on blur in your config? Works for me on macOS:

overlay: {
  hideOnBlur: true,
}
peterdanis commented 6 years ago

Yes, I have hideOnBlure enabled.

gabriellima commented 6 years ago

I could manage to "fix" this issue by adding a win.blur() before win.hide(), as questioned at this Electron issue

The code was changed here before line 367

New version:

        //close without animation
        else {
            findFocus();
            this._win.blur();
            this._win.hide();
        }

Also, I should note that I'm not using animation (animate: false option)

I think that a "full" fix (including animation) would be like this (i.e., always calling blur before hide):

        //control the animation
        if(this._config.animate) {
            this._animating = true;

            //animation end bounds
            this._startBounds();

            setTimeout(() => {
                this._animating = false;
                findFocus();
                                this._win.blur();
                this._win.hide();
            }, 250);
        }
        //close without animation
        else {
            findFocus();
            this._win.blur();
            this._win.hide();
        }
favna commented 6 years ago

Looking into this for my fork hyper-overlay and I cannot replicate the issue on Windows 10 build 1803. When I open the overlay then X or - it out my Windows just focuses back to the previous window that was active.

Can you elaborate on steps to reproduce?

gabriellima commented 6 years ago

@Favna try using the "quake style hide" shortcut.

favna commented 6 years ago

I honestly have no idea what the "quake style hide" is

gabriellima commented 6 years ago

Sorry. You said that clicking X or - would "hide" the window, with Focus going back to previous window.

The bug, at least on my case, was happening when using the shortcut to open/hide the overlay, and not when pressing the buttons.

Regarding the "quake style", I'm sorry, it was my mistake to suppose it was a common knowledge. In my humble opinion, this term started at Quake game, and later on Guake linux "show/hide" terminal.