Closed FischLu closed 1 year ago
I like this idea. Some general thoughts:
Can you add support for all the virtual keys? I think it would make this complete. https://github.com/BenziAhamed/Menu-Bar-Search/blob/f1647cf64acfc2392d2d17d571bf6de746b96856/menu/Sources/menu/AX.swift#L12 Example of a arrow key shortcut:
I think we can probably move the query term parsing to RuntimeArgs
. I already do some stripping of diacritic characters and lowercasing the input here. So this might be a more apt place to preprocess the query term.
https://github.com/BenziAhamed/Menu-Bar-Search/blob/f1647cf64acfc2392d2d17d571bf6de746b96856/menu/Sources/menu/RuntimeArgs.swift#L89
I have moved the parser to RuntimeArgs and add support to all virtual keys, the key code from the AX.swift file, however I think the key name from the comment in the file is too long to type, so I have asked ChatGPT to generate a short version (lazy).... And now all of the shortcut keys can appear at any order during query.
BTW, I removed lowercased()
from let term = args.query.lowercased()
, the args.query is already process by .caseInsensitive
I think you have to add this keycode list to readme
"ctrl", "⌃"
"alt", "⌥"
"shift", "⇧"
"cmd", "⌘"
"ret", "↩"
"kp_ent", "⌤"
"kp_clr", "⌧"
"tab", "⇥"
"space", "␣"
"del", "⌫"
"esc", "⎋"
"caps", "⇪"
"fn", "fn"
"f1", "F1"
"f2", "F2"
"f3", "F3"
"f4", "F4"
"f5", "F5"
"f6", "F6"
"f7", "F7"
"f8", "F8"
"f9", "F9"
"f10", "F10"
"f11", "F11"
"f12", "F12"
"f13", "F13"
"f14", "F14"
"f15", "F15"
"f16", "F16"
"f17", "F17"
"f18", "F18"
"f19", "F19"
"f20", "F20"
"home", "↖"
"pgup", "⇞"
"fwd_del", "⌦"
"end", "↘"
"pgdn", "⇟"
"left", "◀︎"
"right", "▶︎"
"down", "▼"
"up", "▲"
To be able to search shortcuts is important for me in case I need to assign some global shortcut to my Alfred workflow, I have to check whether the shortcut is used by my most commonly used apps.
The short cut searching starts from the symbol
#
, 4 mac modifier keyscmd, shift, alt, ctrl
can appear at any order and separated by space, the single key must be at the last position (o
for example in the image)Also, it is possible to search shortcuts with only modifier keys