Another 2 questions.
Does on_char(code) require panel focus? I have not been able to use it for global shortcuts without the mouse clicking on the panel first, but the documentation does not say anything about it. (while it does on on_key_down/...)
And then.. is there some way to add global shortcuts without panel focus? (without using intervals)
var keyCallbackDate = Date.now();
function keyCallback() {
if (Date.now() - keyCallbackDate <= 500) {return;} // Limit rate to 500 ms
let bDone = false;
Object.keys(shortcuts).forEach((key) => {
if (bDone) {return;}
const shortcut = shortcuts[key];
if (utils.IsKeyPressed(shortcut.val) && (shortcut.mod === -1 || utils.IsKeyPressed(shortcut.mod))) {shortcut.func(shortcut.menu); bDone = true;}
});
if (bDone) {keyCallbackDate = Date.now();}
}
repeatFn(keyCallback, 100)();
Well that doesn't work as expected since it's really "global", and works even with the main foobar window not being in focus.
Adding if (!window.IsVisible) {return;} does not work as intended if using alt-tab. Since the panel window is considered to be visible even if the main program is not on focus (nor in the screen at all). When it's minimized it seems to work though.