Open felipethome opened 4 years ago
Can you share a quick snippet that demonstrations the issue?
Sure! Maybe it is my lack of understanding of the API, sorry if that is the case:
Hotkey.activate(['command', 'option', 'control'], '1', () => {
const mainScreen = Screen.allScreens().find((s) => s.id === 69733248);
const mainChromeWindow = mainScreen.allWindows()
.find((w) => w.app.name === 'Google Chrome');
console.log('focus main chrome');
if (mainChromeWindow) {
mainChromeWindow.focus();
}
});
I can see the console.log is executed, but the window is not brought to the front.
MacOS 10.14.4
I have the same issue with this snippet:
for (const direction of ['left', 'right', 'up', 'down']) {
Hotkey.activate(['command', 'control'], direction, () => {
const focusedWindow = Window.focusedWindow();
if (focusedWindow) {
const windowsInDirection = focusedWindow.windowsInDirection(direction);
if (windowsInDirection[0]) {
console.log(direction, windowsInDirection[0].title());
windowsInDirection[0].focus()
}
}
});
}
The name and the direction is displayed inside the console correctly, but the windows do not get the focus.
When trying to focus a specific window with a Hotkey the window is not being brought to the front. It stays behind other windows. Is this the expected behavior?
And isFocused is being interpreted in the IDE as a property instead of a method.