Added mechanism to hide original and replace
with Baboons logo
This commit is contained in:
parent
e25ea3a546
commit
54497921e3
2
assets
2
assets
|
|
@ -1 +1 @@
|
||||||
Subproject commit bd432f2298901a8566a092636eef0c35a3a80fbc
|
Subproject commit 4e7c9a58ca53231be49d055020c72da3818818b9
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "baboon-desktop",
|
"name": "baboon-desktop",
|
||||||
"productName": "baboon-desktop",
|
"productName": "baboon-desktop",
|
||||||
"version": "0.2.0",
|
"version": "0.3.0",
|
||||||
"main": ".vite/build/main.js",
|
"main": ".vite/build/main.js",
|
||||||
"repository": "SKATTKOOKIE/desktop",
|
"repository": "SKATTKOOKIE/desktop",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import {
|
||||||
} from "electron";
|
} from "electron";
|
||||||
|
|
||||||
import windowIconAsset from "../../assets/desktop/icon.png?asset";
|
import windowIconAsset from "../../assets/desktop/icon.png?asset";
|
||||||
|
import iconSvgRaw from "../../assets/desktop/icon.svg?raw";
|
||||||
|
|
||||||
import { config } from "./config";
|
import { config } from "./config";
|
||||||
import { updateTrayMenu } from "./tray";
|
import { updateTrayMenu } from "./tray";
|
||||||
|
|
@ -90,6 +91,39 @@ export function createMainWindow() {
|
||||||
// Load connect and disconnect sounds
|
// Load connect and disconnect sounds
|
||||||
injectSounds(mainWindow.webContents);
|
injectSounds(mainWindow.webContents);
|
||||||
|
|
||||||
|
// Force hide of Stoat logo and replace with Baboon
|
||||||
|
mainWindow.webContents.on("did-finish-load", () => {
|
||||||
|
mainWindow.webContents.insertCSS(`
|
||||||
|
svg.h_18px { display: none !important; }
|
||||||
|
svg.w_160px { display: none !important; }
|
||||||
|
`);
|
||||||
|
|
||||||
|
const iconUrl = `data:image/svg+xml;base64,${Buffer.from(iconSvgRaw).toString("base64")}`;
|
||||||
|
|
||||||
|
mainWindow.webContents.executeJavaScript(`
|
||||||
|
window.__iconUrl = ${JSON.stringify(iconUrl)};
|
||||||
|
setTimeout(function() {
|
||||||
|
const topLogo = document.querySelector('svg.h_18px');
|
||||||
|
if (topLogo) {
|
||||||
|
const img = document.createElement('img');
|
||||||
|
img.src = window.__iconUrl;
|
||||||
|
img.style.height = '35px';
|
||||||
|
img.style.marginBottom = '1px';
|
||||||
|
topLogo.parentNode.insertBefore(img, topLogo);
|
||||||
|
}
|
||||||
|
|
||||||
|
const centreLogo = document.querySelector('svg.w_160px');
|
||||||
|
if (centreLogo) {
|
||||||
|
const img = document.createElement('img');
|
||||||
|
img.src = window.__iconUrl;
|
||||||
|
img.style.width = '160px';
|
||||||
|
centreLogo.parentNode.insertBefore(img, centreLogo);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
`).catch(() => {});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// minimise window to tray
|
// minimise window to tray
|
||||||
mainWindow.on("close", (event) => {
|
mainWindow.on("close", (event) => {
|
||||||
if (!shouldQuit && config.minimiseToTray) {
|
if (!shouldQuit && config.minimiseToTray) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue