コンテンツにスキップ
Tauri

グローバルショートカット

アプリケーションがフォーカスされていないときでもグローバルキーボードショートカットを登録します。

This plugin requires a Rust version of at least 1.77.2

Platform Level Notes
windows
linux
macos
android
ios

グローバルショートカットプラグインをインストールして開始します。

プロジェクトのパッケージマネージャーを使用して依存関係を追加します。

npm run tauri add global-shortcut

グローバルショートカットプラグインは、JavaScript と Rust の両方で使用できます。

import { register } from '@tauri-apps/plugin-global-shortcut';
await register('CommandOrControl+Shift+C', () => {
console.log('Shortcut triggered');
});

デフォルトでは、すべての潜在的に危険なプラグインコマンドとスコープはブロックされており、アクセスできません。これらを有効にするには、capabilities 設定の権限を変更する必要があります。

詳細については、機能の概要 と、プラグイン権限を使用するための ステップバイステップガイド を参照してください。

src-tauri/capabilities/default.json
{
"permissions": [
...,
"global-shortcut:allow-register",
]
}

Default Permission

No features are enabled by default, as we believe the shortcuts can be inherently dangerous and it is application specific if specific shortcuts should be registered or unregistered.

Permission Table

Identifier Description

global-shortcut:allow-is-registered

Enables the is_registered command without any pre-configured scope.

global-shortcut:deny-is-registered

Denies the is_registered command without any pre-configured scope.

global-shortcut:allow-register

Enables the register command without any pre-configured scope.

global-shortcut:deny-register

Denies the register command without any pre-configured scope.

global-shortcut:allow-register-all

Enables the register_all command without any pre-configured scope.

global-shortcut:deny-register-all

Denies the register_all command without any pre-configured scope.

global-shortcut:allow-unregister

Enables the unregister command without any pre-configured scope.

global-shortcut:deny-unregister

Denies the unregister command without any pre-configured scope.

global-shortcut:allow-unregister-all

Enables the unregister_all command without any pre-configured scope.

global-shortcut:deny-unregister-all

Denies the unregister_all command without any pre-configured scope.


© 2025 Tauri Contributors. CC-BY / MIT