From d5fdcc4b0c796594c2bf4b71d926186fc1265b53 Mon Sep 17 00:00:00 2001 From: aunetx Date: Sun, 10 Oct 2021 11:57:39 +0200 Subject: [PATCH] Flatpak support added --- .gitignore | 3 ++- Makefile | 29 +++++++++++++++++++++-------- quit.patch | 13 +++++++++++++ start-hidden-in-tray.patch | 19 +++++++++++++++++++ 4 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 quit.patch create mode 100644 start-hidden-in-tray.patch diff --git a/.gitignore b/.gitignore index 45d75eb..623926a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ app-32.7z deezer-*.exe package-lock.json package.json -app.7z \ No newline at end of file +app.7z +systray.png \ No newline at end of file diff --git a/Makefile b/Makefile index 8db71b0..3c6528d 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ json_add = '},\ "start": "electron ."\ },\ "devDependencies": {\ - "electron": "^12.0.11",\ + "electron": "^13.5.1",\ "electron-builder": "^22.13.1"\ },\ "build": {\ @@ -24,8 +24,11 @@ json_add = '},\ }\ }' + install_build_deps: npm install --engine-strict asar + npm install prettier + prepare: install_build_deps wget -c $(BASE_URL) -O $(EXE_NAME) @@ -36,23 +39,33 @@ prepare: install_build_deps asar extract source/resources/app.asar app - mkdir -p app/resources/linux/ - install -Dm644 source/resources/win/systray.png app/resources/linux/ + cp source/resources/win/systray.png . - # prettier --write "app/build/*.js" + prettier --write "app/build/*.js" # Hide to tray (https://github.com/SibrenVasse/deezer/issues/4) - # patch -p1 -dresources/app < quit.patch + patch -p1 -dapp < quit.patch + # Add start in tray cli option (https://github.com/SibrenVasse/deezer/pull/12) + patch -p1 -dapp < start-hidden-in-tray.patch head -n -2 app/package.json > tmp.txt && mv tmp.txt app/package.json echo $(json_add) | tee -a app/package.json + +build_flatpak: prepare npm i --prefix=app --package-lock-only ./flatpak-node-generator.py npm app/package-lock.json -o flatpak/generated-sources.json --electron-node-headers --xdg-layout + cd flatpak && flatpak-builder build dev.aunetx.deezer.yml --install --force-clean --user -build: prepare - cd flatpak && flatpak-builder build dev.aunetx.deezer.yml -/*", "build/assets/*-install --force-clean --user + +build_appimage: prepare + npm install --prefix=app + npm run dist --prefix=app + + +run_flatpak: + flatpak run dev.aunetx.deezer clean: - rm -rf app flatpak/{.flatpak-builder,build} node_modules source app-32.7z app.7z deezer-*.exe package-lock.json \ No newline at end of file + rm -rf app flatpak/{.flatpak-builder,build} node_modules source app-32.7z app.7z deezer-*.exe package-lock.json systray.png \ No newline at end of file diff --git a/quit.patch b/quit.patch new file mode 100644 index 0000000..d6fe0c2 --- /dev/null +++ b/quit.patch @@ -0,0 +1,13 @@ +diff --git a/build/main.js b/build/main.js +index 5066eef..46b04c5 100644 +--- a/build/main.js ++++ b/build/main.js +@@ -3079,7 +3080,7 @@ + this._adjustViewToContentSize(), + mainView.setAutoResize({ width: !0, height: !0 }); + } else this.appService.setWindow(this.window, void 0); +- if ((this.appService.setUserAgent(), isPlatform(PLATFORM.DARWIN))) { ++ if ((this.appService.setUserAgent(), isPlatform(PLATFORM.LINUX))) { + let isQuitting = !1; + external_electron_namespaceObject.app.on( + "before-quit", \ No newline at end of file diff --git a/start-hidden-in-tray.patch b/start-hidden-in-tray.patch new file mode 100644 index 0000000..52defae --- /dev/null +++ b/start-hidden-in-tray.patch @@ -0,0 +1,19 @@ +diff --git a/build/main.js b/build/main.js +index 5066eef..592a6bc 100644 +--- a/build/main.js ++++ b/build/main.js +@@ -3122,8 +3122,12 @@ + finalMinSize[1] + ); + } +- isDev() ? this.window.showInactive() : this.window.show(), +- this.thumbar.init(); ++ if (!process.argv.some(arg => arg === '--start-in-tray')) { ++ isDev() ? this.window.showInactive() : this.window.show(), ++ this.thumbar.init(); ++ } else { ++ this.window.hide(); ++ } + }), + this.appService.enableDevMode(); + } \ No newline at end of file