TeaSpeak-Client/modules/core/instance_handler.ts
2019-10-27 22:39:59 +01:00

21 lines
812 B
TypeScript

import * as electron from "electron";
import * as main_window from "./main_window";
export function handle_second_instance_call(argv: string[], work_dir: string) {
const original_args = argv.slice(1).filter(e => !e.startsWith("--original-process-start-time=") && e != "--allow-file-access-from-files");
console.log("Second instance: %o", original_args);
if(!main_window.main_window) {
console.warn("Ignoring second instance call because we haven't yet started");
return;
}
main_window.main_window.focus();
{
const connect_url = argv.find(e => e.startsWith("teaclient://"));
if(connect_url) {
console.log("Received connect url: %s", connect_url);
main_window.main_window.webContents.send('connect', connect_url);
}
}
}