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] global-shortcut should allow re-registering a shortcut, and calling unregister_all when no shortcuts are registered should return success directly. #9806

Closed
Tallone opened this issue May 17, 2024 · 1 comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@Tallone
Copy link

Tallone commented May 17, 2024

Describe the bug

Now when registering a shortcut which already exists, it will return an error: "Hotkey already registered."

When there are no registered shortcuts, calling unregister_all will return an error: "Invalid arguments shortcuts for command unregister_all: command unregister_all missing required key shortcuts."

Reproduction

No response

Expected behavior

When registering a shortcut that already exists, maybe it should directly override it, so that repeated calls do not fail.

When calling unregister_all if there are no registered shortcuts, it should return ok directly, instead of returning an error.

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 124.0.2478.97
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.77.0 (aedd173a2 2024-03-17)
    ✔ cargo: 1.77.0 (3fe68eabf 2024-02-29)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.13.1
    - pnpm: 9.1.0
    - yarn: 1.22.19
    - npm: 10.5.2
    - bun: 1.1.8

[-] Packages
    - tauri [RUST]: 2.0.0-beta.19
    - tauri-build [RUST]: 2.0.0-beta.15
    - wry [RUST]: 0.39.5
    - tao [RUST]: 0.28.0
    - @tauri-apps/api [NPM]: 2.0.0-beta.11
    - @tauri-apps/cli [NPM]: 2.0.0-beta.17

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

Stack trace

No response

Additional context

No response

@Tallone Tallone added status: needs triage This issue needs to triage, applied to new issues type: bug labels May 17, 2024
@amrbashir
Copy link
Member

unregister_all will only unregister registered by your own application and not by the system, the "Hotkey already registered." error means another app has already registered the same shortcut you're trying to register and your app can't hijack that, it is an OS limiation.

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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