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

[bug] open app from deep link will break accessory activation policy #12128

Open
rhinoc opened this issue Jan 2, 2025 · 2 comments
Open

[bug] open app from deep link will break accessory activation policy #12128

rhinoc opened this issue Jan 2, 2025 · 2 comments
Labels
platform: macOS status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@rhinoc
Copy link

rhinoc commented Jan 2, 2025

Describe the bug

I am building a tray app and use set_activation_policy(tauri::ActivationPolicy::Accessory) to hide icon from dock.
Recently I am adding deep link feature to my app, and I found that open app from deep link will make dock icon show again.

I also have a tray menu item to toggle window show/hide and it works just fine. Only when accessing from deep link will cause dock icon appear.

rust:

#[tauri::command]
fn show_window(app_handle: tauri::AppHandle) {
    let window = app_handle.get_webview_window("main");
    if window.is_none() {
        return;
    }
    let w = window.unwrap();
    if !w.is_visible().expect("get is_visible error") {
        let _ = w.show();
        let _ = w.set_focus();
    }
}

js:

onOpenUrl((urls) => {
    invoke("show_window");
});

Currently, my workaround is call set_activation_policy again when open url is triggered. But it won't prevent dock icon showing but only hide it quickly after it reappears, so there still is a moment that the icon showing.

Reproduction

No response

Expected behavior

Dock icon won't show.

Full tauri info output

[✔] Environment
    - OS: Mac OS 15.1.1 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.83.0 (90b35a623 2024-11-26)
    ✔ cargo: 1.83.0 (5ffbef321 2024-10-29)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 22.11.0
    - npm: 10.9.0
    - bun: 1.1.36

[-] 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-shell 🦀: 2.2.0
    - @tauri-apps/plugin-shell : 2.2.0
    - tauri-plugin-updater 🦀: 2.3.0
    - @tauri-apps/plugin-updater : 2.3.0
    - tauri-plugin-autostart 🦀: 2.2.0
    - @tauri-apps/plugin-autostart : 2.2.0
    - tauri-plugin-single-instance 🦀: 2.2.0
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-os 🦀: 2.2.0
    - @tauri-apps/plugin-os : 2.2.0
    - tauri-plugin-log 🦀: 2.2.0
    - @tauri-apps/plugin-log : 2.2.0
    - tauri-plugin-deep-link 🦀: 2.2.0
    - @tauri-apps/plugin-deep-link : 2.2.0
    - tauri-plugin-store 🦀: 2.2.0
    - @tauri-apps/plugin-store : 2.2.0
    - tauri-plugin-window-state 🦀: 2.2.0
    - @tauri-apps/plugin-window-state : 2.2.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Rollup

Stack trace

No response

Additional context

No response

@rhinoc rhinoc added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jan 2, 2025
@FabianLars
Copy link
Member

not gonna lie this sounds like a macos thing 🤔 you wouldn't happen to know of another app or framework where this works fine?

@rhinoc
Copy link
Author

rhinoc commented Jan 3, 2025

@FabianLars I only know native swift app works fine, for example, cleanshot x, it is a tray app and you can use deep link to open it without dock icon appearing.
btw, I found a closed issue about window.show() conflits with set_actionvation_policy #5122, don't know if it is related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: macOS status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants