Skip to content

[feat] add api to get focus window like electron BrowserWindow.getFocusedWindow #6472

@suxiaoshao

Description

@suxiaoshao

Describe the problem

As a Tauri developer, I would like to have a way to retrieve the currently focused window, so that I can perform operations on that window, such as let it as parent_window create child window.

Describe the solution you'd like

javascript

const focusedWindow = WebviewWindow.getFocusWindow()

rust

let id=Window::get_focus_window();
let window = WindowBuilder::new(app, "main", tauri::WindowUrl::App("index.html".into()))
        .parent_window(id)
        .build()?;

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions