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

Overview

hotkey_manager

pub version

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

Discord


Platform Support

Linux macOS Windows
✔️ ✔️ ✔️

Quick Start

Installation

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

dependencies:
  hotkey_manager: ^0.1.5

Or

dependencies:
  hotkey_manager:
    git:
      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() {
  // Must add this line.
  WidgetsFlutterBinding.ensureInitialized();
  // For hot reload, `unregisterAll()` needs to be called.
  hotKeyManager.unregisterAll();

  runApp(MyApp());
}

Register/Unregsiter a system/inapp wide hotkey.

// ⌥ + 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.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?

  • AuthPass - Password Manager based on Flutter for all platforms. Keepass 2.x (kdbx 3.x) compatible.
  • Biyi (比译) - A convenient translation and dictionary app written in dart / Flutter.

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 hotkey. ✔️ ✔️ ✔️
unregister unregister an system/inapp wide hotkey. ✔️ ✔️ ✔️
unregisterAll unregister all system/inapp wide hotkeys. ✔️ ✔️ ✔️

Related Links

License

MIT License

Copyright (c) 2021 LiJianying <[email protected]>

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.
Issues
  • Build failure on Linux

    Build failure on Linux

    Hey, interested to try this out!

    For me it fails to build on a new flutter project as soon as the dependency is added:

    Details
    
    ❯ flutter run -d linux -v
    [  +43 ms] executing: uname -m
    [  +21 ms] Exit code 0 from: uname -m
    [        ] x86_64
    [   +3 ms] executing: [/home/merritt/Applications/tools/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
    [   +5 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
    [        ] 19c61fed0da681ba2068c97e22add3bde38e51e4
    [        ] executing: [/home/merritt/Applications/tools/flutter/] git tag --points-at 19c61fed0da681ba2068c97e22add3bde38e51e4
    [   +9 ms] Exit code 0 from: git tag --points-at 19c61fed0da681ba2068c97e22add3bde38e51e4
    [        ] 2.5.0-5.2.pre
    [   +6 ms] executing: [/home/merritt/Applications/tools/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
    [   +4 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
    [        ] origin/beta
    [        ] executing: [/home/merritt/Applications/tools/flutter/] git ls-remote --get-url origin
    [   +3 ms] Exit code 0 from: git ls-remote --get-url origin
    [        ] https://github.com/flutter/flutter.git
    [  +55 ms] executing: [/home/merritt/Applications/tools/flutter/] git rev-parse --abbrev-ref HEAD
    [   +4 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
    [        ] beta
    [  +47 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
    [   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
    [  +49 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
    [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
    [  +47 ms] Skipping pub get: version match.
    [  +14 ms] Found plugin hotkey_manager at /home/merritt/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.6/
    [  +71 ms] Found plugin hotkey_manager at /home/merritt/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.6/
    [  +14 ms] Generating /home/merritt/Downloads/flutter_hotkey_demo/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
    [  +71 ms] Initializing file store
    [   +5 ms] Skipping target: gen_localizations
    [   +2 ms] Skipping target: gen_dart_plugin_registrant
    [        ] Skipping target: _composite
    [   +1 ms] complete
    [   +3 ms] Launching lib/main.dart on Linux in debug mode...
    [   +3 ms] /home/merritt/Applications/tools/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
    /home/merritt/Applications/tools/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root
    /home/merritt/Applications/tools/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names --experimental-emit-debug-metadata
    -DFLUTTER_WEB_AUTO_DETECT=true --output-dill /tmp/flutter_tools.ZEJHLO/flutter_tool.PYCTQJ/app.dill --packages /home/merritt/Downloads/flutter_hotkey_demo/.dart_tool/package_config.json
    -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill
    build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill --enable-experiment=alternative-invalidation-strategy
    [  +18 ms] Building Linux application...
    [  +14 ms] <- compile package:flutter_hotkey_demo/main.dart
    [   +1 ms] executing: [build/linux/x64/debug/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DFLUTTER_TARGET_PLATFORM=linux-x64 /home/merritt/Downloads/flutter_hotkey_demo/linux
    [  +35 ms] -- Checking for module 'keybinder-3.0'
    [        ] --   No package 'keybinder-3.0' found
    [        ] -- Configuring incomplete, errors occurred!
    [        ] See also "/home/merritt/Downloads/flutter_hotkey_demo/build/linux/x64/debug/CMakeFiles/CMakeOutput.log".
    [        ] CMake Error at /usr/share/cmake-3.18/Modules/FindPkgConfig.cmake:545 (message):
    [        ]   A required package was not found
    [        ] Call Stack (most recent call first):
    [        ]   /usr/share/cmake-3.18/Modules/FindPkgConfig.cmake:733 (_pkg_check_modules_internal)
    [        ]   flutter/ephemeral/.plugin_symlinks/hotkey_manager/linux/CMakeLists.txt:10 (pkg_check_modules)
    [   +8 ms] Building Linux application... (completed in 56ms)
    [+5525 ms] Exception: Unable to generate build files
    [        ] "flutter run" took 5,920ms.
    [   +3 ms] 
               #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
               #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:669:9)
               <asynchronous suspension>
               #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
               <asynchronous suspension>
               #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
               <asynchronous suspension>
               #4      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
               <asynchronous suspension>
               #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
               <asynchronous suspension>
               #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
               <asynchronous suspension>
               #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
               <asynchronous suspension>
               #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
               <asynchronous suspension>
               #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
               <asynchronous suspension>
               #10     main (package:flutter_tools/executable.dart:92:3)
               <asynchronous suspension>
               
               
    [  +81 ms] ensureAnalyticsSent: 79ms
    [   +1 ms] Running shutdown hooks
    [        ] Shutdown hooks complete
    [        ] exiting with code 1
    
    

    ❯ flutter --version Flutter 2.5.0-5.2.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision 19c61fed0d (13 days ago) • 2021-08-18 17:10:31 -0700 Engine • revision 7a4c4505f6 Tools • Dart 2.14.0 (build 2.14.0-377.7.beta)

    opened by Merrit 8
  • Not able to compile on Linux

    Not able to compile on Linux

    Hi, I tried version 0.1.7 on MacOS: it works :) I tried the same code on Linux (Ubuntu), I can't compile and get the following error:

    ERROR: ../../.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.1.7/lib/src/hotkey_manager.dart:42:17: Error: The getter 'repeat' isn't defined for the class 'RawKeyDownEvent'.
    ERROR:  - 'RawKeyDownEvent' is from 'package:flutter/src/services/raw_keyboard.dart' ('../flutter/packages/flutter/lib/src/services/raw_keyboard.dart').
    ERROR: Try correcting the name to the name of an existing getter, or defining a getter or field named 'repeat'.
    ERROR:       if (value.repeat) return;
    

    For info, I installed keybinder-3.0 and libkeybinder-3.0-dev.

    [✓] Flutter (Channel stable, 2.8.1, on Ubuntu 20.04.4 LTS 5.13.0-40-generic, locale en_US.UTF-8)
        • Flutter version 2.8.1 at /home/fab/Git/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 77d935af4d (5 months ago), 2021-12-16 08:37:33 -0800
        • Engine revision 890a5fca2e
        • Dart version 2.15.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /home/fab/Android/Sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: /snap/android-studio/119/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
        • All Android licenses accepted.
    
    [✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
        ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
    
    [✓] Linux toolchain - develop for Linux desktop
        • clang version 10.0.0-4ubuntu1
        • cmake version 3.16.3
        • ninja version 1.10.0
        • pkg-config version 0.29.1
    
    [✓] Android Studio (version 2021.1)
        • Android Studio at /snap/android-studio/119/android-studio
        • Flutter plugin version 67.1.1
        • Dart plugin version 211.7817
        • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    
    [✓] Connected device (1 available)
        • Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.4 LTS 5.13.0-40-generic
    
    opened by hotlittlewhitedog 4
  • Overriding platform-wide shortcuts?

    Overriding platform-wide shortcuts?

    Tried the example app, and I wasn't able to register a new shortcut for already defined macOS-level shortcuts, for example Command + Q(which quits the app) or Command + Space(brings up Spotlight search).

    Is there any way to be able to override such keyboard combos? I am sure this is possible on other desktop apps, e.g. I can do it for iTerm or Android Studio through their keyboard preferences, so I am looking to also have that feature in my Flutter app.

    opened by whiplashoo 3
  • Can not response

    Can not response "Ctrl + Shift + Z" if "Ctrl + Z" has been registered first

    Please try the code sample appended. If "Ctrl + Shift + Z" is registerd after "Ctrl + Z", it it does not work

    I think this is caused by the HotKeyManager._handleRawKeyEvent method using _hotKeyList.firstWhere to match the hotkey. Maybe you need sort _hotKeyList after register a new hotkey or match modifierKey strictly in HotKeyManager._handleRawKeyEvent

    Code sample
    import 'package:flutter/material.dart';
    import 'package:hotkey_manager/hotkey_manager.dart';
    
    void main() {
      WidgetsFlutterBinding.ensureInitialized();
      hotKeyManager.unregisterAll();
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: const MyHomePage(title: 'Flutter Demo Home Page'),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      const MyHomePage({Key? key, required this.title}) : super(key: key);
    
      final String title;
    
      @override
      State<MyHomePage> createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      String lastAcceptedHotkey = '';
    
      HotKey ctrlZ = HotKey(
        KeyCode.keyZ,
        modifiers: [KeyModifier.control],
        scope: HotKeyScope.inapp,
      );
    
      HotKey ctrlShiftZ = HotKey(
        KeyCode.keyZ,
        modifiers: [KeyModifier.control, KeyModifier.shift],
        scope: HotKeyScope.inapp,
      );
    
      void _keyUpHandler(HotKey hotkey) {
        lastAcceptedHotkey = hotkey.toString();
        setState(() {});
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: Column(
            children: [
              ElevatedButton(
                onPressed: () async {
                  await hotKeyManager.unregisterAll();
                  hotKeyManager.register(ctrlZ, keyUpHandler: _keyUpHandler);
                  hotKeyManager.register(ctrlShiftZ, keyUpHandler: _keyUpHandler);
                },
                child: const Text('Register order: CtrlZ, CtrlShiftZ'),
              ),
              ElevatedButton(
                onPressed: () async {
                  await hotKeyManager.unregisterAll();
                  hotKeyManager.register(ctrlShiftZ, keyUpHandler: _keyUpHandler);
                  hotKeyManager.register(ctrlZ, keyUpHandler: _keyUpHandler);
                },
                child: const Text('Register order: CtrlShiftZ, CtrlZ'),
              ),
              Text('lastAcceptedHotkey: $lastAcceptedHotkey'),
            ],
          ),
        );
      }
    }
    
    
    opened by tgalpha 1
  • 注册应用内热键(alt+s)后,触发一次后按住(alt)会一直触发

    注册应用内热键(alt+s)后,触发一次后按住(alt)会一直触发

    问题

    注册应用内热键(alt+s)后,触发一次后按住(alt)会一直触发

    环境

    [√] Flutter (Channel stable, 2.10.2, on Microsoft Windows [Version 10.0.18363.1556], locale zh-CN) [√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.2) [√] Android Studio (version 2021.1) [√] IntelliJ IDEA Ultimate Edition (version 2020.3) [√] IntelliJ IDEA Ultimate Edition (version 2021.2)

    代码

    本库示例代码

    opened by MoonBlueSky 1
  • Registering a system already defined shortcut cause the old stop working

    Registering a system already defined shortcut cause the old stop working

    When you register, e.g. Command + C , that is Copy , the callback is called but the copy stops working. Any way to preserve the system predefined and the custom?

    opened by gatsbys 1
  • compilation error on Flutter 2.5.0-5.2.pre

    compilation error on Flutter 2.5.0-5.2.pre

    flutter --version
    Flutter 2.5.0-5.2.pre • channel beta • https://github.com/flutter/flutter.git
    Framework • revision 19c61fed0d (10 days ago) • 2021-08-18 17:10:31 -0700
    Engine • revision 7a4c4505f6
    Tools • Dart 2.14.0 (build 2.14.0-377.7.beta)
    

    The results of flutter run -v

    [  +14 ms]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:6:36:
    Error: Getter not found: 'none'.
    [        ]   KeyCode.none: LogicalKeyboardKey.none,
    [        ]                                    ^^^^
    [   +7 ms]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:12:37:
    Error: Getter not found: 'turbo'.
    [        ]   KeyCode.turbo: LogicalKeyboardKey.turbo,
    [        ]                                     ^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:13:51:
    Error: Getter not found: 'privacyScreenToggle'.
    [        ]   KeyCode.privacyScreenToggle: LogicalKeyboardKey.privacyScreenToggle,
    [        ]                                                   ^^^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:16:51:
    Error: Getter not found: 'displayToggleIntExt'.
    [        ]   KeyCode.displayToggleIntExt: LogicalKeyboardKey.displayToggleIntExt,
    [        ]                                                   ^^^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:17:43:
    Error: Getter not found: 'usbReserved'.
    [        ]   KeyCode.usbReserved: LogicalKeyboardKey.usbReserved,
    [        ]                                           ^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:18:48:
    Error: Getter not found: 'usbErrorRollOver'.
    [        ]   KeyCode.usbErrorRollOver: LogicalKeyboardKey.usbErrorRollOver,
    [        ]                                                ^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:19:43:
    Error: Getter not found: 'usbPostFail'.
    [        ]   KeyCode.usbPostFail: LogicalKeyboardKey.usbPostFail,
    [        ]                                           ^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:20:49:
    Error: Getter not found: 'usbErrorUndefined'.
    [        ]   KeyCode.usbErrorUndefined: LogicalKeyboardKey.usbErrorUndefined,
    [        ]                                                 ^^^^^^^^^^^^^^^^^
    [   +1 ms]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:159:47:
    Error: Getter not found: 'numpadBackspace'.
    [        ]   KeyCode.numpadBackspace: LogicalKeyboardKey.numpadBackspace,
    [        ]                                               ^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:160:49:
    Error: Getter not found: 'numpadMemoryStore'.
    [        ]   KeyCode.numpadMemoryStore: LogicalKeyboardKey.numpadMemoryStore,
    [        ]                                                 ^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:161:50:
    Error: Getter not found: 'numpadMemoryRecall'.
    [        ]   KeyCode.numpadMemoryRecall: LogicalKeyboardKey.numpadMemoryRecall,
    [        ]                                                  ^^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:162:49:
    Error: Getter not found: 'numpadMemoryClear'.
    [        ]   KeyCode.numpadMemoryClear: LogicalKeyboardKey.numpadMemoryClear,
    [        ]                                                 ^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:163:47:
    Error: Getter not found: 'numpadMemoryAdd'.
    [        ]   KeyCode.numpadMemoryAdd: LogicalKeyboardKey.numpadMemoryAdd,
    [        ]                                               ^^^^^^^^^^^^^^^
    [   +1 ms]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:164:52:
    Error: Getter not found: 'numpadMemorySubtract'.
    [        ]   KeyCode.numpadMemorySubtract: LogicalKeyboardKey.numpadMemorySubtract,
    [        ]                                                    ^^^^^^^^^^^^^^^^^^^^
    [   +1 ms]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:165:48:
    Error: Getter not found: 'numpadSignChange'.
    [        ]   KeyCode.numpadSignChange: LogicalKeyboardKey.numpadSignChange,
    [        ]                                                ^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:166:43:
    Error: Getter not found: 'numpadClear'.
    [        ]   KeyCode.numpadClear: LogicalKeyboardKey.numpadClear,
    [        ]                                           ^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:167:48:
    Error: Getter not found: 'numpadClearEntry'.
    [        ]   KeyCode.numpadClearEntry: LogicalKeyboardKey.numpadClearEntry,
    [        ]                                                ^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:180:48:
    Error: Getter not found: 'brightnessToggle'.
    [        ]   KeyCode.brightnessToggle: LogicalKeyboardKey.brightnessToggle,
    [        ]                                                ^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:181:49:
    Error: Getter not found: 'brightnessMinimum'.
    [        ]   KeyCode.brightnessMinimum: LogicalKeyboardKey.brightnessMinimum,
    [        ]                                                 ^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:182:49:
    Error: Getter not found: 'brightnessMaximum'.
    [        ]   KeyCode.brightnessMaximum: LogicalKeyboardKey.brightnessMaximum,
    [        ]                                                 ^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:183:46:
    Error: Getter not found: 'brightnessAuto'.
    [        ]   KeyCode.brightnessAuto: LogicalKeyboardKey.brightnessAuto,
    [        ]                                              ^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:184:42:
    Error: Getter not found: 'kbdIllumUp'.
    [        ]   KeyCode.kbdIllumUp: LogicalKeyboardKey.kbdIllumUp,
    [        ]                                          ^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:185:44:
    Error: Getter not found: 'kbdIllumDown'.
    [        ]   KeyCode.kbdIllumDown: LogicalKeyboardKey.kbdIllumDown,
    [        ]                                            ^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:188:44:
    Error: Getter not found: 'programGuide'.
    [        ]   KeyCode.programGuide: LogicalKeyboardKey.programGuide,
    [        ]                                            ^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:203:41:
    Error: Getter not found: 'bassBoost'.
    [        ]   KeyCode.bassBoost: LogicalKeyboardKey.bassBoost,
    [        ]                                         ^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:204:43:
    Error: Getter not found: 'mediaSelect'.
    [        ]   KeyCode.mediaSelect: LogicalKeyboardKey.mediaSelect,
    [        ]                                           ^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:210:42:
    Error: Getter not found: 'launchApp2'.
    [        ]   KeyCode.launchApp2: LogicalKeyboardKey.launchApp2,
    [        ]                                          ^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:211:42:
    Error: Getter not found: 'launchApp1'.
    [        ]   KeyCode.launchApp1: LogicalKeyboardKey.launchApp1,
    [        ]                                          ^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:212:53:
    Error: Getter not found: 'launchInternetBrowser'.
    [        ]   KeyCode.launchInternetBrowser: LogicalKeyboardKey.launchInternetBrowser,
    [        ]                                                     ^^^^^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:214:42:
    Error: Getter not found: 'lockScreen'.
    [        ]   KeyCode.lockScreen: LogicalKeyboardKey.lockScreen,
    [        ]                                          ^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:216:42:
    Error: Getter not found: 'selectTask'.
    [        ]   KeyCode.selectTask: LogicalKeyboardKey.selectTask,
    [        ]                                          ^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:217:47:
    Error: Getter not found: 'launchDocuments'.
    [        ]   KeyCode.launchDocuments: LogicalKeyboardKey.launchDocuments,
    [        ]                                               ^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:219:52:
    Error: Getter not found: 'launchKeyboardLayout'.
    [        ]   KeyCode.launchKeyboardLayout: LogicalKeyboardKey.launchKeyboardLayout,
    [        ]                                                    ^^^^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:222:50:
    Error: Getter not found: 'launchAudioBrowser'.
    [        ]   KeyCode.launchAudioBrowser: LogicalKeyboardKey.launchAudioBrowser,
    [        ]                                                  ^^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:241:52:
    Error: Getter not found: 'keyboardLayoutSelect'.
    [        ]   KeyCode.keyboardLayoutSelect: LogicalKeyboardKey.keyboardLayoutSelect,
    [        ]                                                    ^^^^^^^^^^^^^^^^^^^^
    [        ]
    ../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/hotkey_manager-0.0.3/lib/src/enums/key_code.dart:242:46:
    Error: Getter not found: 'showAllWindows'.
    [        ]   KeyCode.showAllWindows: LogicalKeyboardKey.showAllWindows,
    [        ]                                              ^^^^^^^^^^^^^^
    [+1601 ms] note: Build preparation complete
    
    opened by rburgst 1
  • Add null conditional for toJson

    Add null conditional for toJson

    If one attempts to register a system hotkey without specifying modifiers the app crashes with: "Lost connection to device." because the toJson method is returning null for modifiers.

    Reproduce issue

    Omit modifiers (crash):

    Future<void> main() async {
      WidgetsFlutterBinding.ensureInitialized();
      hotKeyManager.unregisterAll();
      final hotkey = HotKey(
        KeyCode.keyQ,
        // modifiers: [],
      );
      await hotKeyManager.register(
        hotkey,
        keyDownHandler: (hotKey) => print('key pressed'),
      );
      runApp(const MyApp());
    }
    

    Empty modifiers (no crash):

    Future<void> main() async {
      WidgetsFlutterBinding.ensureInitialized();
      hotKeyManager.unregisterAll();
      final hotkey = HotKey(
        KeyCode.keyQ,
        modifiers: [],
      );
      await hotKeyManager.register(
        hotkey,
        keyDownHandler: (hotKey) => print('key pressed'),
      );
      runApp(const MyApp());
    }
    
    opened by Merrit 0
  • [windows] Improve platform channel implementation & fix bugs

    [windows] Improve platform channel implementation & fix bugs

    Improvements made for Windows:

    • Remove additional ::GetMessage loop to avoid staying in memory.
    • Now handling hotkeys directly from RegisterTopLevelWindowProcDelegate.
    • Eliminate namespace scoped variables.
    • Use Google style for C++.
    • Other improvements like using std::unordered_map & global scope resolution for win32 calls.
    opened by alexmercerind 0
  • KeyCode.backquote注册时空指针异常

    KeyCode.backquote注册时空指针异常

    环境:macos flutter sdk 3.0.1 hotkey_manager: ^0.1.7

    HotKey( KeyCode.backquote, modifiers: [KeyModifier.control], scope: HotKeyScope.system, ) KeyCode.backquote报错,使用KeyCode.keyQ就不会 hotkey_manager/HotkeyManagerPlugin.swift:42: Fatal error: Unexpectedly found nil while unwrapping an Optional value

    opened by ZXQ-Kyle 2
Releases(v0.1.7)
Owner
LeanFlutter
To make the flutter even simpler
LeanFlutter
hotcaKey is the global shortcut (aka hotkey) module for node.js and electron.

?? hotcaKey is the global shortcut (aka hotkey) module for node.js and electron. hotcakey is now actively under deploment, so api may have

daylilyfield 6 Jun 20, 2022
Playbit System interface defines an OS-like computing platform which can be implemented on a wide range of hosts

PlaySys The Playbit System interface PlaySys defines an OS-like computing platform which can be implemented on a wide range of hosts like Linux, BSD,

Playbit 227 Jun 22, 2022
This plugin allows Flutter desktop apps to Auto launch on startup / login.

This plugin allows Flutter desktop apps to Auto launch on startup / login.

LeanFlutter 28 Jun 18, 2022
A Flutter package that makes it easy to customize and work with your Flutter desktop app's system tray.

system_tray A Flutter package that that enables support for system tray menu for desktop flutter apps. on Windows, macOS and Linux. Features: - Modify

AnTler 103 Jun 24, 2022
Dwm_lut - Apply 3D LUTs to the Windows desktop for system-wide color correction/calibration

About This tool applies 3D LUTs to the Windows desktop by hooking into DWM. It works in both SDR and HDR modes, and uses tetrahedral interpolation on

null 127 Jun 25, 2022
This repo contains example software for the Kernelcon 2021 Hack Live! badge - the Hacker HotKey.

Hacker HotKey This repo contains example software for the Kernelcon 2021 Hack Live! badge - the Hacker HotKey. Default Hotkey Mapping Hacker Hotkey is

Kernelcon 14 Jan 24, 2022
Make your Pop!_OS (Ubuntu Linux) shortcut key experience more like Mac OS

Meta Mac Enables a Mac OS-like shortcut key experience on Pop!_OS (and most Ubuntu-based Linux distros). Installation Download or git clone this repos

Duane Johnson 12 Jun 28, 2022
SDK for building cross-platform desktop apps in ANSI-C

NAppGUI Cross-Platform C SDK. Build portable desktop applications for Windows, macOS and Linux, using just C. Quick start in Windows Prerequisites Vis

Francisco García Collado 194 Jun 23, 2022
Native context menu for Flutter apps

native_context_menu Native context menu for flutter apps Installation flutter pub add native_context_menu Usage import 'package:native_context_menu/na

Andrei Lesnitsky 132 Jun 4, 2022
An app that allows you to edit/create apps in Dash

AppAdder On Ubuntu, have you ever run a program or AppImage and the app not had an icon? This is a personal pet peeve. I've used AppImageLauncher to i

Camden 5 Jun 25, 2022
Flutter-Clock-and-Reminder-App - a highly functional clock and reminder app developed on flutter framework.

clock_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Umar Baloch 5 Dec 27, 2021
The package allows to use H3 library directly in your Flutter application

The package allows to use H3 library directly in your Flutter application

Ilya Beregovskiy 9 Jun 17, 2022
"Zero setup" cross-compilation for a wide variety of architectures.

"Zero setup" cross-compilation for a wide variety of architectures. xcross includes compact docker images and a build utility for minimal setup C/C++ cross-compiling, inspired by rust-embedded/cross

Alexander Huszagh 24 May 20, 2022
An open collection of tools and experiments for rendering wide-gamut scene-linear data into an image for an SDR or HDR display device.

Open Display Transform An open collection of tools and experiments for rendering wide-gamut scene-linear data into an image for an SDR or HDR display

Jed Smith 111 Jun 27, 2022
A desktop (supports macOS and Windows) implementation of uni_links plugin.

uni_links_desktop A desktop (supports macOS and Windows) implementation of uni_links plugin. uni_links_desktop Platform Support Quick Start Installati

LeanFlutter 10 May 23, 2022
A cross-platform (Android/iOS/Windows/macOS) cronet plugin for Flutter via `dart:ffi`

cronet_flutter A cross-platform (Android/iOS/Windows/macOS) cronet plugin for Flutter via dart:ffi

null 20 Jun 15, 2022
A Flutter Web Plugin to display Text Widget as Html for SEO purpose

SEO Renderer A flutter plugin (under development) to render text widgets as html elements for SEO purpose. Created specifically for issue https://gith

Sahdeep Singh 88 Jun 17, 2022
A new JS script plugin for flutter

js_script Run JS script. Usage // Create a JS context. JsScript script = JsScript(); // Define a class. var classInfo = ClassInfo<TestClass>( newI

null 5 Mar 8, 2022
A cross-platform flutter plugin for C/C++/ObjC crash report via Google Breakpad

quick_breakpad A cross-platform flutter plugin for C/C++/ObjC crash report via Google Breakpad Use breakpad for quick_breakpad_example $CLI_BREAKPAD i

Woodemi Co., Ltd 15 Apr 26, 2022