我认为您可以将鼠标光标移动到较新的 13+ 版本的 Karabiner-Elements(我不能与 MacOS High Sierra 一起使用)中的指定位置。
不过我担心,首先要获得选择的 x 和 y 值非常困难。
但是:
您可以使用 AppleScript UI 属性“AXFocusedUIElement”右键单击选定的 UI 元素。
(这确实适用于 Finder 窗口文件和文件夹以及 TextEdit 选择,例如,但遗憾的是不适用于 Safari 选择和 Finder 桌面上的文件。)
如果您的主要目标是在 Finder 的窗口中导航,则此脚本* 可以完美运行。
{ "description": "Right-click via Karabiner-Elements/shell-command/AppleScript",
"manipulators": [ {
"type": "basic",
"from": {
"key_code": "left_arrow",
"modifiers": {"mandatory": "left_control" }
},
"to": [ {
"shell_command": "osascript -e 'tell application \"System Events\" to set _/¯
activeApp to name of first process whose frontmost is true \n tell application _/¯
\"System Events\" to tell application process activeApp \n set mySelect _/¯
to value of attribute \"AXFocusedUIElement\" \n tell mySelect to perform _/¯
action \"AXShowMenu\" \n end tell'"
} ] } ]
}
请注意,整个 osascript ( "osascript -e ' ... >> ... end tell'" ) 必须是单行的(我插入了 "_/¯" 以提高可读性)。
(* AppleScript“tell application ... end tell”部分在网上有多种版本。
并且:当然,您可以将我的 Ctrl-LeftArrow 快捷方式更改为您喜欢的任何一个。)