diff --git a/README.md b/README.md index 032cd06..7f0df2c 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,8 @@ ELECTRON_ARGS="--no-sandbox --trace-warnings" Tray mode is disabled by default. It allows program to be minimized to tray instead of closing. To enable it set `TRAY_ENABLED` option to `1`. +Temporary unavailable from v5.30.3 + ![image](https://github.com/cucumber-sp/yandex-music-linux/assets/100789522/5998ba7f-9ee7-4725-9d51-fbe5510a799d) *** @@ -209,11 +211,10 @@ bash repack.sh [-o OUTPUT_DIR default=./app] ### Arch Linux -You can build `pacman` package file manually using `PKGBUILD` file from the this repository. Run following commands in folder with `PKGBUILD` file inside to get `.pkg.tar.zst` package: +You can build `pacman` package file manually using `PKGBUILD` file from the this repository. Run following commands in folder with `PKGBUILD` file inside to build and install the package: ```bash -pacman -S electron libpulse -makepkg +makepkg -si ``` *** diff --git a/patches/0001-Add-package-licence.patch b/patches/0001-Add-package-licence.patch deleted file mode 100644 index c4fcdda..0000000 --- a/patches/0001-Add-package-licence.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/package.json b/package.json ---- a/package.json -+++ b/package.json -@@ -49,5 +49,6 @@ - "kk", - "uz" - ] -- } -+ }, -+ "license": "UNLICENSED" - } diff --git a/patches/0004-Dev-Tools-from-config.patch b/patches/0001-Dev-Tools-from-config.patch similarity index 100% rename from patches/0004-Dev-Tools-from-config.patch rename to patches/0001-Dev-Tools-from-config.patch diff --git a/patches/0002-Create-app-tray-icon.patch b/patches/0002-Create-app-tray-icon.patch deleted file mode 100644 index 37a5bdb..0000000 --- a/patches/0002-Create-app-tray-icon.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff --git a/main/lib/createTray.js b/main/lib/createTray.js ---- a/main/lib/createTray.js -+++ b/main/lib/createTray.js -@@ -0,0 +1,21 @@ -+const { app, Menu, Tray, nativeImage } = require('electron'); -+const path = require('path'); -+ -+function createTray(window) { -+ const iconPath = path.join(__dirname, '../../app/favicon.png'); -+ const tray = new Tray(iconPath); -+ const contextMenu = Menu.buildFromTemplate([ -+ {label: 'Открыть', click: () => window.show()}, -+ {label: 'Закрыть Яндекс Музыку', click: () => app.quit()} -+ ]); -+ tray.setToolTip('Яндекс Музыка'); -+ tray.setContextMenu(contextMenu); -+ -+ tray.on('click', () => { -+ window.show(); -+ }); -+ tray.setIgnoreDoubleClickEvents(true); -+} -+ -+exports.createTray = createTray; -+ - - -diff --git a/main/index.js b/main/index.js ---- a/main/index.js -+++ b/main/index.js -@@ -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; -+ 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); - - -diff --git a/main/lib/handlers/handleWindowLifecycleEvents.js b/main/lib/handlers/handleWindowLifecycleEvents.js ---- a/main/lib/handlers/handleWindowLifecycleEvents.js -+++ b/main/lib/handlers/handleWindowLifecycleEvents.js -@@ -31,9 +31,8 @@ const handleWindowLifecycleEvents = (window) => { - state_js_1.state.willQuit = true; - }); - electron_1.app.on('window-all-closed', () => { -- if (node_os_1.default.platform() === platform_js_1.Platform.WINDOWS) { -- electron_1.app.quit(); -- } -+ const trayEnabled = process.env.TRAY_ENABLED && process.env.TRAY_ENABLED > 0; -+ if (!trayEnabled) {electron_1.app.quit();} - }); - electron_1.app.on('browser-window-blur', () => { - setBlurredTime(); -@@ -54,22 +53,11 @@ const handleWindowLifecycleEvents = (window) => { - checkAndUpdateApplicationData(window); - }); - window.on('close', (event) => { -- if (node_os_1.default.platform() !== platform_js_1.Platform.MACOS) { -- return; -- } -- if (state_js_1.state.willQuit) { -- return; -- } -+ const trayEnabled = process.env.TRAY_ENABLED && process.env.TRAY_ENABLED > 0; -+ if (!trayEnabled) {electron_1.app.quit();} -+ if (state_js_1.state.willQuit) {return;} - event.preventDefault(); -- if (window.isFullScreen()) { -- window.once('leave-full-screen', () => { -- (0, createWindow_js_1.toggleWindowVisibility)(window, false); -- }); -- window.setFullScreen(false); -- } -- else { -- (0, createWindow_js_1.toggleWindowVisibility)(window, false); -- } -+ (0, createWindow_js_1.toggleWindowVisibility)(window, false); - }); - const webContents = window.webContents; - webContents.on('did-fail-load', (event, errorCode, errorDescription, validatedUrl) => { diff --git a/patches/0005-Custom-title-bar.patch b/patches/0002-Custom-title-bar.patch similarity index 73% rename from patches/0005-Custom-title-bar.patch rename to patches/0002-Custom-title-bar.patch index 181f1b5..b006eea 100644 --- a/patches/0005-Custom-title-bar.patch +++ b/patches/0002-Custom-title-bar.patch @@ -1,13 +1,17 @@ diff --git a/main/index.js b/main/index.js --- a/main/index.js +++ b/main/index.js -@@ -52,7 +52,8 @@ Logger_js_1.Logger.setupLogger(); - const trayEnabled = process.env.TRAY_ENABLED && process.env.TRAY_ENABLED > 0; - if (trayEnabled){createTray(window);} +@@ -46,7 +46,12 @@ Logger_js_1.Logger.setupLogger(); + (0, handleBackgroundTasks_js_1.handleBackgroundTasks)(window); + (0, handleCrash_js_1.handleCrash)(); await (0, loadURL_js_1.loadURL)(window); -- if (node_os_1.default.platform() === platform_js_1.Platform.WINDOWS) { +- if ([platform_js_1.Platform.WINDOWS, platform_js_1.Platform.LINUX].includes(deviceInfo_js_1.devicePlatform)) { + const customTitleBar = process.env.CUSTOM_TITLE_BAR && process.env.CUSTOM_TITLE_BAR > 0; ++ const platforms = [platform_js_1.Platform.WINDOWS]; + if (customTitleBar) { ++ platforms.push(platform_js_1.Platform.LINUX); ++ } ++ if (platforms.includes(deviceInfo_js_1.devicePlatform)) { (0, customTitleBar_js_1.createCustomTitleBar)(window); } if (config_js_1.config.enableAutoUpdate) { @@ -16,22 +20,25 @@ diff --git a/main/index.js b/main/index.js 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) => { +@@ -38,13 +38,13 @@ 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 withFrame = [platform_js_1.Platform.WINDOWS, platform_js_1.Platform.MACOS].includes(deviceInfo_js_1.devicePlatform); ++ const withFrame = !customTitleBar; const window = new electron_1.BrowserWindow({ show: false, center: true, + frame: withFrame, - 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 diff --git a/patches/0003-Fix-window-resize.patch b/patches/0003-Fix-window-resize.patch deleted file mode 100644 index 8ad7409..0000000 --- a/patches/0003-Fix-window-resize.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/main/lib/createWindow.js b/main/lib/createWindow.js ---- a/main/lib/createWindow.js -+++ b/main/lib/createWindow.js -@@ -45,8 +45,6 @@ const createWindow = async () => { - x: 16, - y: 10 - }, -- minWidth: 768, -- minHeight: 650, - width: 1280, - height: 800, - webPreferences: { diff --git a/repack.sh b/repack.sh index a72eb42..d048bad 100755 --- a/repack.sh +++ b/repack.sh @@ -72,8 +72,8 @@ echo "Spoofing OS" find "./" -type f \( -name "*.js" -o -name "*.js.map" \) -print0 | while IFS= read -r -d $'\0' file; do # Use 'sed' to perform the replacement in-place sed -i "s/r.t.WINDOWS/r.t.LINUX/g" "$file" - sed -i "s/B.LINUX/B.WINDOWS/g" "$file" - sed -i "s/t4T.WINDOWS/t4T[window.CUSTOM_TITLE_BAR ? 'LINUX' : 'WINDOWS']/g" "$file" + sed -i "s/l.isLinuxApplication/(window.CUSTOM_TITLE_BAR)/g" "$file" + sed -i "s/a.isLinuxApplication/(window.CUSTOM_TITLE_BAR)/g" "$file" done echo "OS spoofed"