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

58 lines
2.6 KiB
Diff
Raw Normal View History

2024-09-24 02:05:03 +03:00
diff --git a/main/index.js b/main/index.js
--- a/main/index.js
+++ b/main/index.js
2024-12-06 23:06:35 +03:00
@@ -46,7 +46,12 @@ Logger_js_1.Logger.setupLogger();
(0, handleBackgroundTasks_js_1.handleBackgroundTasks)(window);
(0, handleCrash_js_1.handleCrash)();
2024-09-24 02:05:03 +03:00
await (0, loadURL_js_1.loadURL)(window);
2024-12-06 23:06:35 +03:00
- if ([platform_js_1.Platform.WINDOWS, platform_js_1.Platform.LINUX].includes(deviceInfo_js_1.devicePlatform)) {
2024-10-03 19:27:06 +03:00
+ const customTitleBar = process.env.CUSTOM_TITLE_BAR && process.env.CUSTOM_TITLE_BAR > 0;
2024-12-06 23:06:35 +03:00
+ const platforms = [platform_js_1.Platform.WINDOWS];
2024-10-03 19:27:06 +03:00
+ if (customTitleBar) {
2024-12-06 23:06:35 +03:00
+ platforms.push(platform_js_1.Platform.LINUX);
+ }
+ if (platforms.includes(deviceInfo_js_1.devicePlatform)) {
2024-10-03 19:27:06 +03:00
(0, customTitleBar_js_1.createCustomTitleBar)(window);
}
2024-09-24 02:05:03 +03:00
if (config_js_1.config.enableAutoUpdate) {
2024-10-03 19:27:06 +03:00
diff --git a/main/lib/createWindow.js b/main/lib/createWindow.js
--- a/main/lib/createWindow.js
+++ b/main/lib/createWindow.js
2024-12-06 23:06:35 +03:00
@@ -38,13 +38,13 @@ const toggleWindowState = (window) => {
2024-10-03 19:27:06 +03:00
(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 () => {
2024-12-06 23:06:35 +03:00
- const withFrame = [platform_js_1.Platform.WINDOWS, platform_js_1.Platform.MACOS].includes(deviceInfo_js_1.devicePlatform);
+ const withFrame = !customTitleBar;
2024-10-03 19:27:06 +03:00
const window = new electron_1.BrowserWindow({
show: false,
center: true,
2024-12-06 23:06:35 +03:00
frame: withFrame,
2024-10-03 19:27:06 +03:00
- titleBarStyle: 'hidden',
trafficLightPosition: {
x: 16,
y: 10
2024-12-06 23:06:35 +03:00
2024-10-03 19:27:06 +03:00
diff --git a/main/lib/preload.js b/main/lib/preload.js
--- a/main/lib/preload.js
+++ b/main/lib/preload.js
2024-10-15 15:18:22 +03:00
@@ -7,10 +7,12 @@ const deviceInfo_js_1 = require("./deviceInfo.js");
const theme_js_1 = require("../types/theme.js");
2024-10-03 19:27:06 +03:00
const hostnamePatterns_js_1 = require("../constants/hostnamePatterns.js");
2024-10-15 15:18:22 +03:00
const deviceInfo = (0, deviceInfo_js_1.getDeviceInfo)();
2024-10-03 19:27:06 +03:00
+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));
2024-10-15 15:18:22 +03:00
electron_1.contextBridge.exposeInMainWorld('PLATFORM', deviceInfo.os);
electron_1.contextBridge.exposeInMainWorld('DEVICE_INFO', deviceInfo);
2024-10-03 19:27:06 +03:00
+electron_1.contextBridge.exposeInMainWorld('CUSTOM_TITLE_BAR', customTitleBar);
electron_1.contextBridge.exposeInMainWorld('desktopEvents', {
send(name, ...args) {
electron_1.ipcRenderer.send(name, ...args);