2020-09-12 13:49:20 +00:00
|
|
|
import {EventType} from "../../../ui/frames/log/Definitions";
|
|
|
|
import {Settings, settings} from "../../../settings";
|
2020-07-23 17:31:31 +00:00
|
|
|
|
|
|
|
const focusDefaultStatus = {};
|
|
|
|
focusDefaultStatus[EventType.CLIENT_POKE_RECEIVED] = true;
|
|
|
|
|
|
|
|
export function requestWindowFocus() {
|
2020-07-23 18:00:25 +00:00
|
|
|
if(__build.target === "web") {
|
|
|
|
window.focus();
|
|
|
|
} else {
|
|
|
|
/* TODO: Abstract that! */
|
|
|
|
const { remote } = __non_webpack_require__("electron");
|
|
|
|
remote.getCurrentWindow().show();
|
|
|
|
}
|
2020-07-23 17:31:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function isFocusRequestEnabled(type: EventType) {
|
|
|
|
return settings.global(Settings.FN_EVENTS_FOCUS_ENABLED(type), focusDefaultStatus[type as any] || false);
|
|
|
|
}
|