tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] How to display a window without taking focus in Linux

Open witt-bit opened this issue 1 year ago • 1 comments

Describe the bug

I am trying to implement a function: a pop-up floating window does not grab the focus of the previous application. For example, I am renaming a file and a floating window is opened through a shortcut key. I should be in the file name editing state and the window is displayed on the top layer.

Currently, there is no API that can achieve this effect

Reproduction

I tried the functions request_user_attention and set_ignore_cursor_events, also without calling set_focus

Expected behavior

No response

Full tauri info output

$ pnpm tauri info                                                                                                                 INT ✘ 

> [email protected] tauri /home/witt/codes/open-source/EcoPaste
> tauri "info"


[✔] Environment
    - OS: Manjaro 24.1.2 x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.44.4
    ✔ rsvg2: 2.58.4
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (2024-05-07)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 23.0.0
    - pnpm: 9.12.2
    - yarn: 1.22.22
    - npm: 10.9.0

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.2
    - tao 🦀: 0.30.8
    - @tauri-apps/api : 2.1.1
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-log 🦀: 2.0.2
    - @tauri-apps/plugin-log : 2.0.0
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1
    - tauri-plugin-dialog 🦀: 2.0.3
    - @tauri-apps/plugin-dialog : 2.0.1
    - tauri-plugin-process 🦀: 2.0.1
    - @tauri-apps/plugin-process : 2.0.0
    - tauri-plugin-single-instance 🦀: 2.0.1
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-updater 🦀: 2.0.2
    - @tauri-apps/plugin-updater : 2.0.0
    - tauri-plugin-global-shortcut 🦀: 2.0.1
    - @tauri-apps/plugin-global-shortcut : 2.0.0
    - tauri-plugin-fs 🦀: 2.0.3
    - @tauri-apps/plugin-fs : 2.0.2
    - tauri-plugin-sql 🦀: 2.0.2
    - @tauri-apps/plugin-sql : 2.0.1
    - tauri-plugin-os 🦀: 2.0.1
    - @tauri-apps/plugin-os : 2.0.0
    - tauri-plugin-autostart 🦀: 2.0.1
    - @tauri-apps/plugin-autostart : 2.0.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

No response

witt-bit avatar Nov 28 '24 03:11 witt-bit

What if you set WebviewWindowBuilder::focused to false?

Legend-Master avatar Nov 28 '24 04:11 Legend-Master