패키지, 저장소 및 앱 카테고리 검색

패키지 상세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 앱과의 비침습적 통합
  • 충돌 및 중복 등록 처리

적합한 대상

  • 다양한 운영 체제를 대상으로 하는 데스크톱 앱 개발자
  • 생산성 및 유틸리티 소프트웨어
  • 고급 키보드 상호작용이 필요한 앱
  • 접근성 있는 데스크톱 경험을 구축하는 개발자

고려 사항

  • 일부 시스템에서는 플랫폼별 권한이 필요합니다
  • 기존 시스템 단축키와 충돌할 수 있습니다
  • 데스크톱 플랫폼 전용
  • 메모리 누수를 방지하기 위해 적절한 정리가 필요합니다
  • 모바일 또는 웹 애플리케이션에 적합하지 않습니다

원본 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

소스 저장소

이 패키지를 사용하는 프로젝트