hotkey_manager 0.0.5 copy "hotkey_manager: ^0.0.5" to clipboard
hotkey_manager: ^0.0.5 copied to clipboard

outdated

This plugin allows Flutter desktop apps to defines system/inapp wide hot key.

hotkey_manager #

pub version

This plugin allows Flutter desktop apps to defines system/inapp wide hot key.

Platform Support #

Linux macOS Windows
✔️ ✔️ ✔️

Quick Start #

Installation #

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

dependencies:
  hotkey_manager: ^0.0.5

Or

dependencies:
  hotkey_manager:
    git:
      url: https://github.com/leanflutter/hotkey_manager.git
      ref: main

Usage #

Register/Unregsiter a system/inapp wide hot key.

import 'package:hotkey_manager/hotkey_manager.dart';

// ⌥ + Q
HotKey _hotKey = HotKey(
  KeyCode.keyQ,
  modifiers: [KeyModifier.alt],
  // Set hotkey scope (default is HotKeyScope.system)
  scope: HotKeyScope.inapp, // Set as inapp-wide hotkey.
);

await HotKeyManager.instance.register(
  _hotKey,
  keyDownHandler: (hotKey) {
    print('onKeyDown+${hotKey.toJson()}');
  },
  // Only works on macOS.
  keyUpHandler: (hotKey){
    print('onKeyUp+${hotKey.toJson()}');
  } ,
);

await HotKeyManager.instance.unregister(_hotKey);

Use HotKeyRecorder widget to help you record a hot key.

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

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

Discussion #

Welcome to join the discussion group to share your suggestions and ideas with me.

API #

HotKeyManager #

Method Description Linux macOS Windows
register register an system/inapp wide hot key. ✔️ ✔️ ✔️
unregister unregister an system/inapp wide hot key. ✔️ ✔️ ✔️

License #

MIT License

Copyright (c) 2021 LiJianying <lijy91@foxmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
115
likes
0
pub points
93%
popularity

Publisher

verified publisherleanflutter.dev

This plugin allows Flutter desktop apps to defines system/inapp wide hot key.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, uuid

More

Packages that depend on hotkey_manager