|
|
|
|
@ -8,6 +8,7 @@ import macInit from './services/mac_init.js';
|
|
|
|
|
import electronContextMenu from "./menus/electron_context_menu.js";
|
|
|
|
|
import glob from "./services/glob.js";
|
|
|
|
|
import { t } from "./services/i18n.js";
|
|
|
|
|
import options from "./services/options.js";
|
|
|
|
|
|
|
|
|
|
await appContext.earlyInit();
|
|
|
|
|
|
|
|
|
|
@ -47,19 +48,25 @@ function initOnElectron() {
|
|
|
|
|
const electron = utils.dynamicRequire('electron');
|
|
|
|
|
electron.ipcRenderer.on('globalShortcut', async (event, actionName) => appContext.triggerCommand(actionName));
|
|
|
|
|
|
|
|
|
|
if (options.get("nativeTitleBarVisible") !== "true") {
|
|
|
|
|
initTitleBarButtons();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initTitleBarButtons() {
|
|
|
|
|
function applyTitleBarOverlaySettings() {
|
|
|
|
|
const electronRemote = utils.dynamicRequire("@electron/remote");
|
|
|
|
|
const currentWindow = electronRemote.getCurrentWindow();
|
|
|
|
|
const documentStyle = window.getComputedStyle(document.documentElement);
|
|
|
|
|
const color = documentStyle.getPropertyValue("--native-titlebar-background");
|
|
|
|
|
const symbolColor = documentStyle.getPropertyValue("--native-titlebar-foreground");
|
|
|
|
|
currentWindow.setTitleBarOverlay({ color, symbolColor });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update the native title bar buttons.
|
|
|
|
|
applyTitleBarOverlaySettings();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Register for changes to the native title bar colors.
|
|
|
|
|
window.matchMedia("(prefers-color-scheme: dark)")
|
|
|
|
|
.addEventListener("change", applyTitleBarOverlaySettings);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function applyTitleBarOverlaySettings() {
|
|
|
|
|
const electronRemote = utils.dynamicRequire("@electron/remote");
|
|
|
|
|
const currentWindow = electronRemote.getCurrentWindow();
|
|
|
|
|
const documentStyle = window.getComputedStyle(document.documentElement);
|
|
|
|
|
const color = documentStyle.getPropertyValue("--native-titlebar-background");
|
|
|
|
|
const symbolColor = documentStyle.getPropertyValue("--native-titlebar-foreground");
|
|
|
|
|
currentWindow.setTitleBarOverlay({ color, symbolColor });
|
|
|
|
|
}
|