パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.3.0

hotkey_manager

このプラグインにより、Flutter デスクトップアプリがシステム/アプリ内全体のホットキー(つまりショートカット)を定義できるようになります。

macOSWindowsLinux
30日間ダウンロード
6.8万
いいね数
147
Pub ポイント
140

パッケージをインストール

flutter pub add hotkey_manager

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

hotkey_manager パッケージは、macOS、Windows、Linux 上の Flutter デスクトップアプリケーションがシステム全体またはアプリ内でのキーボードショートカットを登録および応答できるようにします。開発者は、アクティブなアプリに関係なく特定の操作をトリガーするカスタムホットキーを定義でき、ユーザーの生産性とアクセシビリティを向上させます。このプラグインは Flutter のイベント処理とシームレスに統合されており、Ctrl+Shift+S や Cmd+T などのキーコンビネーションを管理するための簡単な API を提供します。メニューをナビゲートせずに機能への迅速アクセスが必要なアプリに最適です。

用途

  • アプリのアクション用のグローバルショートカットを作成する
  • 頻繁に使用される機能への迅速なアクセスを有効にする
  • キーボードナビゲーションによるアクセシビリティの向上
  • ショートカットサポートを活用した生産性ツールの構築
  • 既存のデスクトップワークフローとの統合

主な機能

  • 複数プラットフォーム間でシステムワイドなホットキーをサポート
  • キーの組み合わせを定義するためのシンプルな API
  • クロスプラットフォーム互換性(macOS、Windows、Linux)
  • Flutter アプリとの非侵襲的な統合
  • 競合および重複登録を処理します

適している対象

  • 複数のオペレーティングシステムをターゲットにするデスクトップアプリ開発者
  • 生産性およびユーティリティソフトウェア
  • 高度なキーボード操作を必要とするアプリ
  • アクセシブルなデスクトップ体験を構築する開発者

注意事項

  • 一部のシステムでは、プラットフォーム固有の権限が必要です
  • 既存のシステムショートカットと競合する可能性があります
  • デスクトッププラットフォームのみ対応
  • メモリリークを回避するための適切なクリーンアップが必要です
  • モバイルまたはWebアプリケーションには適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

🚀 Ship Your App Faster: Try Fastforge - The simplest way to build, package and distribute your Flutter apps.

hotkey_manager

pub version

This plugin allows Flutter desktop apps to defines system/inapp wide hotkey (i.e. shortcut).


English | 简体中文


Platform Support

Linux macOS Windows
✔️ ✔️ ✔️

Quick Start

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  hotkey_manager: ^0.2.3

Or

dependencies:
  hotkey_manager:
    git:
      path: packages/hotkey_manager
      url: https://github.com/leanflutter/hotkey_manager.git
      ref: main
Linux requirements

Run the following command

sudo apt-get install keybinder-3.0
Usage
import 'package:hotkey_manager/hotkey_manager.dart';

void main() async {
  // Must add this line.
  WidgetsFlutterBinding.ensureInitialized();
  // For hot reload, `unregisterAll()` needs to be called.
  await hotKeyManager.unregisterAll();

  runApp(MyApp());
}

Register/Unregsiter a system/inapp wide hotkey.

// ⌥ + Q
HotKey _hotKey = HotKey(
  key: PhysicalKeyboardKey.keyQ,
  modifiers: [HotKeyModifier.alt],
  // Set hotkey scope (default is HotKeyScope.system)
  scope: HotKeyScope.inapp, // Set as inapp-wide hotkey.
);
await hotKeyManager.register(
  _hotKey,
  keyDownHandler: (hotKey) {
    print('onKeyDown+${hotKey.toJson()}');
  },
  // Only works on macOS.
  keyUpHandler: (hotKey){
    print('onKeyUp+${hotKey.toJson()}');
  } ,
);

await hotKeyManager.unregister(_hotKey);

await hotKeyManager.unregisterAll();

Use HotKeyRecorder widget to help you record a hotkey.

HotKeyRecorder(
  onHotKeyRecorded: (hotKey) {
    _hotKey = hotKey;
    setState(() {});
  },
),

Please see the example app of this plugin for a full example.

Who's using it?

  • Airclap - Send any file to any device. cross platform, ultra fast and easy to use.
  • AuthPass - Password Manager based on Flutter for all platforms. Keepass 2.x (kdbx 3.x) compatible.
  • Biyi (比译) - A convenient translation and dictionary app.

API

HotKeyManager
Method Description Linux macOS Windows
register register an system/inapp wide hotkey. ✔️ ✔️ ✔️
unregister unregister an system/inapp wide hotkey. ✔️ ✔️ ✔️
unregisterAll unregister all system/inapp wide hotkeys. ✔️ ✔️ ✔️

Related Links

  • https://github.com/soffes/HotKey
  • https://github.com/kupferlauncher/keybinder

License

MIT

カテゴリー

依存関係

依存関係一覧 4 件

  • hotkey_manager_platform_interface^0.2.0
  • nativeapi^0.5.6
  • uni_platform^0.1.3
  • uuid>=3.0.7 <5.0.0

ソースリポジトリ

このパッケージを使用しているプロジェクト