macOS only! Get menu shortcuts by window owner name.
$ npm install window-shortcuts
import windowShortcuts from 'window-shortcuts'
windowShortcuts('iTerm2')
.then(shortcuts => {
console.log(shortcuts)
/*
[
{
"title": "Preferences...",
"keys": [
"Meta",
","
],
"group": "iTerm2"
},
{
"keys": [
"Meta",
"h",
],
"title": "Hide iTerm2",
"group": "iTerm2",
},
...
]
*/
})
.catch(error => console.log(error))
const shortcuts = windowShortcuts.sync('iTerm2')