Flatpak support added

This commit is contained in:
aunetx 2021-10-10 11:57:39 +02:00
parent 7cca1f4717
commit d5fdcc4b0c
4 changed files with 55 additions and 9 deletions

3
.gitignore vendored
View File

@ -8,4 +8,5 @@ app-32.7z
deezer-*.exe
package-lock.json
package.json
app.7z
app.7z
systray.png

View File

@ -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
rm -rf app flatpak/{.flatpak-builder,build} node_modules source app-32.7z app.7z deezer-*.exe package-lock.json systray.png

13
quit.patch Normal file
View File

@ -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",

View File

@ -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();
}