diff --git a/README.md b/README.md index 89e10e1..231cbd4 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ Native YandexMusic client for Linux. Built using repacking of Windows client (El - [Custom Electron binary](#custom-electron-binary) - [Electron arguments](#electron-arguments) - [Tray mode](#tray-mode) + - [Dev tools](#dev-tools) + - [Custom title bar](#custom-title-bar) - [Manual Build](#manual-build) - [Prerequisites](#prerequisites) - [Extract app only](#extract-app-only) @@ -150,6 +152,12 @@ Chromium developer/debug tools can be enabled by setting `DEV_TOOLS` option to ` *** +### Custom title bar + +Yandex Music's custom Windows-styled titlebar can be enabled by setting `CUSTOM_TITLE_BAR` option to `1`. Also makes the window frameless. + +*** + ## Manual Build ### Prerequisites diff --git a/patches/0001-Add-package-licence.patch b/patches/0001-Add-package-licence.patch index 88fc6b9..c4fcdda 100644 --- a/patches/0001-Add-package-licence.patch +++ b/patches/0001-Add-package-licence.patch @@ -1,9 +1,9 @@ diff --git a/package.json b/package.json --- a/package.json +++ b/package.json -@@ -50,5 +50,6 @@ +@@ -49,5 +49,6 @@ "kk", - "az" + "uz" ] - } + }, diff --git a/patches/0002-Create-app-tray-icon.patch b/patches/0002-Create-app-tray-icon.patch index dddb3e6..37a5bdb 100644 --- a/patches/0002-Create-app-tray-icon.patch +++ b/patches/0002-Create-app-tray-icon.patch @@ -28,9 +28,9 @@ diff --git a/main/lib/createTray.js b/main/lib/createTray.js diff --git a/main/index.js b/main/index.js --- a/main/index.js +++ b/main/index.js -@@ -46,6 +46,9 @@ Logger_js_1.Logger.setupLogger(); - (0, handleDeeplink_js_1.handleDeeplink)(window); +@@ -48,6 +48,9 @@ Logger_js_1.Logger.setupLogger(); (0, handleMetrikaRequests_js_1.handleMetrikaRequests)(window); + (0, handleFrames_js_1.handleFrames)(window); (0, handleCrash_js_1.handleCrash)(); + const {createTray} = require('./lib/createTray.js'); + const trayEnabled = process.env.TRAY_ENABLED && process.env.TRAY_ENABLED > 0; diff --git a/patches/0004-Dev-Tools-from-config.patch b/patches/0004-Dev-Tools-from-config.patch index a86ca5e..dc1039c 100644 --- a/patches/0004-Dev-Tools-from-config.patch +++ b/patches/0004-Dev-Tools-from-config.patch @@ -12,4 +12,4 @@ diff --git a/main/config.js b/main/config.js + enableDevTools: devTools, enableWebSecurity: true, enableAutoUpdate: true, - enableUpdateByProbability: false, + enableUpdateByProbability: true, diff --git a/patches/0005-Custom-title-bar.patch b/patches/0005-Custom-title-bar.patch index 0ff0c0c..4a1c296 100644 --- a/patches/0005-Custom-title-bar.patch +++ b/patches/0005-Custom-title-bar.patch @@ -1,14 +1,50 @@ diff --git a/main/index.js b/main/index.js --- a/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; if (trayEnabled){createTray(window);} await (0, loadURL_js_1.loadURL)(window); - if (node_os_1.default.platform() === platform_js_1.Platform.WINDOWS) { -- (0, customTitleBar_js_1.createCustomTitleBar)(window); -- } -+ (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); + } 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); diff --git a/repack.sh b/repack.sh index 3f3af68..bbdcc16 100755 --- a/repack.sh +++ b/repack.sh @@ -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 sed -i "s/a.t.WINDOWS/a.t.LINUX/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 echo "OS spoofed"