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

Expose focus() to Window #1737

Closed
probablykasper opened this issue Apr 24, 2021 · 9 comments
Closed

Expose focus() to Window #1737

probablykasper opened this issue Apr 24, 2021 · 9 comments

Comments

@probablykasper
Copy link
Member

Is your feature request related to a problem? Please describe.
Calling win.show() in the frontend does not bring the window (or at least not the app) to focus

Describe the solution you'd like
Electron handles this by having win.show() and win.showInactive(). I would personally prefer win.show(focus: true)

@lucasfernog lucasfernog transferred this issue from tauri-apps/tauri Apr 24, 2021
@amrbashir
Copy link
Member

what is your OS info ?

@probablykasper
Copy link
Member Author

macOS 10.14.6

@amrbashir
Copy link
Member

On linux: we can use present_with_time() https://gtk-rs.org/docs/gtk/trait.GtkWindowExt.html#tymethod.present_with_time

On windows: there is a lot of functions to try and maybe combine them SetForegroundWindow, SetActiveWindow and SetFocus.

On Macos: google search reveals this [NSWindow makeKeyAndOrderFront: nil]; https://discourse.libcinder.org/t/how-to-bring-a-window-to-foreground-and-or-have-focus/1176/4

@lemarier
Copy link
Member

We should check if it’s related to tauri-apps/wry#184

@wusyong
Copy link
Member

wusyong commented May 4, 2021

Closed by tauri-apps/wry#220

@wusyong wusyong closed this as completed May 4, 2021
@probablykasper
Copy link
Member Author

probablykasper commented May 4, 2021

@wusyong What's the intended solution in tauri-apps/wry#220? Assuming it's supposed to make appWindow.show() focus the window, it doesn't seem to be doing it (tested on latest tauri commit 935db26)

@lemarier lemarier reopened this May 7, 2021
@lemarier lemarier changed the title appWindow.show doesn't bring focus to window Expose focus() to Window May 7, 2021
@lemarier
Copy link
Member

lemarier commented May 7, 2021

We should expose focus to the Window. When window is already open, but hidden behind other windows, calling focus should bring the window at the top.

@lemarier lemarier transferred this issue from tauri-apps/wry May 7, 2021
@lemarier
Copy link
Member

lemarier commented May 7, 2021

Related to tauri-apps/tao#22

@lemarier lemarier transferred this issue from tauri-apps/tao May 7, 2021
@lemarier
Copy link
Member

Merged in tauri-apps/tao#28

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

4 participants