feat(electron): set overlay information at runtime

This commit is contained in:
Elian Doran
2024-12-01 02:18:35 +02:00
parent 0089346d04
commit 60192977c9
2 changed files with 17 additions and 3 deletions

View File

@@ -30,8 +30,7 @@ bundleService.getWidgetBundlesByParent().then(async widgetBundles => {
glob.setupGlobs();
if (utils.isElectron()) {
utils.dynamicRequire('electron').ipcRenderer.on('globalShortcut',
async (event, actionName) => appContext.triggerCommand(actionName));
initOnElectron();
}
macInit.init();
@@ -43,3 +42,18 @@ noteAutocompleteService.init();
if (utils.isElectron()) {
electronContextMenu.setupContextMenu();
}
function initOnElectron() {
const electron = utils.dynamicRequire('electron');
electron.ipcRenderer.on('globalShortcut', async (event, actionName) => appContext.triggerCommand(actionName));
// Update the native title bar buttons.
const electronRemote = utils.dynamicRequire("@electron/remote");
const currentWindow = electronRemote.getCurrentWindow();
currentWindow.setTitleBarOverlay({
color: "red",
symbolColor: "white"
});
console.log("Electron initialized.");
}