Git Product home page Git Product logo

Comments (3)

Eric0x avatar Eric0x commented on August 19, 2024

i had the same problem

from hotkey_manager.

Zhoucheng133 avatar Zhoucheng133 commented on August 19, 2024

的确存在这样的问题,应该是没有聚焦,有一个比较折中的解决办法就是添加一个系统菜单:

if(Platform.isMacOS) PlatformMenuBar(
  menu: [
    // ...
  ]
)

详细写法:PlatformMenuBar class - Flutter API

然后添加一个shortcut属性就好了

from hotkey_manager.

lijy91 avatar lijy91 commented on August 19, 2024

请升级到 v0.2.0,这个版本已经做了处理,具体看这里

bool _handleInAppHotKeyEvent(KeyEvent keyEvent) {
if (_hotKeyList.where((e) => e.scope == HotKeyScope.inapp).isEmpty) {
return false;
}
if (keyEvent is KeyUpEvent && _lastPressedHotKey != null) {
HotKeyHandler? handler = _keyUpHandlerMap[_lastPressedHotKey!.identifier];
if (handler != null) handler(_lastPressedHotKey!);
_lastPressedHotKey = null;
return true;
}
if (keyEvent is KeyRepeatEvent && _lastPressedHotKey != null) {
return true;
}
if (keyEvent is KeyDownEvent) {
final physicalKeysPressed = HardwareKeyboard.instance.physicalKeysPressed;
HotKey? hotKey = _hotKeyList.firstWhereOrNull(
(e) {
List<HotKeyModifier>? modifiers = HotKeyModifier.values
.where((e) => e.physicalKeys.any(physicalKeysPressed.contains))
.toList();
return e.scope == HotKeyScope.inapp &&
keyEvent.logicalKey == e.logicalKey &&
modifiers.every((e.modifiers ?? []).contains);
},
);
if (hotKey != null) {
HotKeyHandler? handler = _keyDownHandlerMap[hotKey.identifier];
if (handler != null) handler(hotKey);
_lastPressedHotKey = hotKey;
return true;
}
}
return false;
}

from hotkey_manager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.