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

Add do not fix quit flag

Electron is quite unoptimised technology and running YM window in
foreground requires a lot of cpu usage. So hiding window to background
is more feature, then bug =)

Change-Id: Id4e00303379004b6353a88efd7232e180f80fe6d
This commit is contained in:
Yury Shvedov 2024-01-30 21:32:35 +03:00
parent b977be55f1
commit a75f59cd80
3 changed files with 15 additions and 5 deletions

View File

@ -20,6 +20,9 @@
{ {
packages = rec { packages = rec {
yandex-music = yandex-music-with pkgs; yandex-music = yandex-music-with pkgs;
yandex-music-backgroud = yandex-music.override {
fixQuit = false;
};
default = yandex-music; default = yandex-music;
}; };
} }

View File

@ -10,6 +10,7 @@
, jq , jq
, ymExe , ymExe
, fixQuit ? true
}: }:
let let
app = runCommand "yandex-music-app" app = runCommand "yandex-music-app"
@ -18,7 +19,7 @@ let
repack = ./../repack.sh; repack = ./../repack.sh;
src = ymExe; src = ymExe;
} '' } ''
bash "$repack" -o "$out" "$src" bash "$repack" ${if !fixQuit then "-q" else ""} -o "$out" "$src"
''; '';
launcher = writeShellApplication { launcher = writeShellApplication {
name = "yandex-music"; name = "yandex-music";

View File

@ -3,20 +3,23 @@
set -e set -e
usage() { usage() {
echo "Usage: $(basename "$0") [-xh] [ -o DIR] YANDEX_MUSIC_EXE" echo "Usage: $(basename "$0") [-xqh] [ -o DIR] YANDEX_MUSIC_EXE"
echo echo
echo " Options:" echo " Options:"
echo " -o DIR Path to destination folder" echo " -o DIR Path to destination folder"
echo " -x Extract and fix only to destination folder" echo " -x Extract and fix only to destination folder"
echo " -q Do not apply application quit fix"
echo " -h Show this help and exit" echo " -h Show this help and exit"
} }
exe_location= exe_location=
dst="$PWD/app" dst="$PWD/app"
while getopts :xo:h name; do fix_quit=1
while getopts :xo:qh name; do
case $name in case $name in
x) extract_only=1 ;; x) extract_only=1 ;;
o) dst="$OPTARG" ;; o) dst="$OPTARG" ;;
q) fix_quit=0 ;;
h) h)
usage usage
exit 0 exit 0
@ -79,8 +82,11 @@ find "./" -type f -name "*.html" -print0 | while IFS= read -r -d $'\0' file; do
done done
echo "Title Fixed" echo "Title Fixed"
echo "Fixing App Quiting" if [ "$fix_quit" == "1" ]; then
sed -i "s/window.on('close', (event) => {/window.on('close', (event) => {electron_1.app.quit();/g" "./main/lib/handlers/handleWindowLifecycleEvents.js" echo "Fixing App Quiting"
sed -i "s/window.on('close', (event) => {/window.on('close', (event) => {electron_1.app.quit();/g" \
"./main/lib/handlers/handleWindowLifecycleEvents.js"
fi
if ! command -v jq &>/dev/null; then if ! command -v jq &>/dev/null; then
echo "Error: jq is not installed. Please install jq to proceed." >&2 echo "Error: jq is not installed. Please install jq to proceed." >&2