0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-23 22:22:59 +03:00

Make custom title bar optional

This commit is contained in:
Andrey Onishchenko 2024-10-03 19:27:06 +03:00
parent 9feff7b064
commit 524b782f31
2 changed files with 43 additions and 7 deletions

View File

@ -1,14 +1,50 @@
diff --git a/main/index.js b/main/index.js diff --git a/main/index.js b/main/index.js
--- a/main/index.js --- a/main/index.js
+++ b/main/index.js +++ b/main/index.js
@@ -50,9 +50,7 @@ Logger_js_1.Logger.setupLogger(); @@ -52,7 +52,8 @@ Logger_js_1.Logger.setupLogger();
const trayEnabled = process.env.TRAY_ENABLED && process.env.TRAY_ENABLED > 0; const trayEnabled = process.env.TRAY_ENABLED && process.env.TRAY_ENABLED > 0;
if (trayEnabled){createTray(window);} if (trayEnabled){createTray(window);}
await (0, loadURL_js_1.loadURL)(window); await (0, loadURL_js_1.loadURL)(window);
- if (node_os_1.default.platform() === platform_js_1.Platform.WINDOWS) { - if (node_os_1.default.platform() === platform_js_1.Platform.WINDOWS) {
- (0, customTitleBar_js_1.createCustomTitleBar)(window); + const customTitleBar = process.env.CUSTOM_TITLE_BAR && process.env.CUSTOM_TITLE_BAR > 0;
- } + if (customTitleBar) {
+ (0, customTitleBar_js_1.createCustomTitleBar)(window); (0, customTitleBar_js_1.createCustomTitleBar)(window);
}
if (config_js_1.config.enableAutoUpdate) { if (config_js_1.config.enableAutoUpdate) {
updater.start();
updater.onUpdate((version) => {
diff --git a/main/lib/createWindow.js b/main/lib/createWindow.js
--- a/main/lib/createWindow.js
+++ b/main/lib/createWindow.js
@@ -36,11 +36,12 @@ const toggleWindowState = (window) => {
(0, tray_js_1.updateTrayMenu)(window);
};
exports.toggleWindowState = toggleWindowState;
+const customTitleBar = process.env.CUSTOM_TITLE_BAR && process.env.CUSTOM_TITLE_BAR > 0;
const createWindow = async () => {
const window = new electron_1.BrowserWindow({
show: false,
center: true,
- titleBarStyle: 'hidden',
+ frame: !customTitleBar,
trafficLightPosition: {
x: 16,
y: 10
diff --git a/main/lib/preload.js b/main/lib/preload.js
--- a/main/lib/preload.js
+++ b/main/lib/preload.js
@@ -10,10 +10,12 @@ const getInitialTheme_js_1 = require("./getInitialTheme.js");
const theme_js_1 = require("../constants/theme.js");
const hostnamePatterns_js_1 = require("../constants/hostnamePatterns.js");
const getDeviceInfo_js_1 = require("./getDeviceInfo.js");
+const customTitleBar = process.env.CUSTOM_TITLE_BAR && process.env.CUSTOM_TITLE_BAR > 0;
electron_1.contextBridge.exposeInMainWorld('VERSION', String(config_js_1.config.buildInfo.VERSION));
electron_1.contextBridge.exposeInMainWorld('BRANCH', String(config_js_1.config.buildInfo.BRANCH));
electron_1.contextBridge.exposeInMainWorld('PLATFORM', node_os_1.default.platform());
electron_1.contextBridge.exposeInMainWorld('DEVICE_INFO', (0, getDeviceInfo_js_1.getDeviceInfo)());
+electron_1.contextBridge.exposeInMainWorld('CUSTOM_TITLE_BAR', customTitleBar);
electron_1.contextBridge.exposeInMainWorld('desktopEvents', {
send(name, ...args) {
electron_1.ipcRenderer.send(name, ...args);

View File

@ -73,7 +73,7 @@ find "./" -type f \( -name "*.js" -o -name "*.js.map" \) -print0 | while IFS= re
# Use 'sed' to perform the replacement in-place # Use 'sed' to perform the replacement in-place
sed -i "s/a.t.WINDOWS/a.t.LINUX/g" "$file" sed -i "s/a.t.WINDOWS/a.t.LINUX/g" "$file"
sed -i "s/B.LINUX/B.WINDOWS/g" "$file" sed -i "s/B.LINUX/B.WINDOWS/g" "$file"
sed -i "s/t4T.WINDOWS/t4T.LINUX/g" "$file" sed -i "s/t4T.WINDOWS/t4T[window.CUSTOM_TITLE_BAR ? 'LINUX' : 'WINDOWS']/g" "$file"
done done
echo "OS spoofed" echo "OS spoofed"