fix: parse hotkey (#5167)

* fix: incorrectly parse hotkey

* refactor: parse hotkey

* fix: panic on linux

* chore: update

* chore: update style

* fix: register hotkey error on windows

* chore: update style

---------

Co-authored-by: Tunglies <tunglies.dev@outlook.com>
This commit is contained in:
oomeow
2025-10-23 15:54:48 +08:00
committed by GitHub
parent 585963e751
commit d7859b07a6
6 changed files with 25 additions and 80 deletions

View File

@@ -676,7 +676,14 @@ async fn create_tray_menu(
.filter_map(|item| {
let mut parts = item.split(',');
match (parts.next(), parts.next()) {
(Some(func), Some(key)) => Some((func.into(), key.into())),
(Some(func), Some(key)) => {
// 托盘菜单中的 `accelerator` 属性,在 Linux/Windows 中都不支持小键盘按键的解析
if key.to_uppercase().contains("NUMPAD") {
None
} else {
Some((func.into(), key.into()))
}
}
_ => None,
}
})