0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2025-09-28 01:29:03 +03:00

Config file support / Wayland (no nix)

This commit is contained in:
Andrey Onishchenko
2024-03-12 22:20:14 +03:00
parent 1c96b3f0ab
commit 870091c7ca
5 changed files with 39 additions and 8 deletions

View File

@@ -29,10 +29,11 @@ package() {
install -Dm644 "$srcdir/app/favicon.svg" "$pkgdir/usr/share/icons/hicolor/scalable/apps/yandex-music.svg"
install -Dm644 "$srcdir/yandex-music-linux/templates/desktop" "$pkgdir/usr/share/applications/yandex-music.desktop"
install -Dm644 "$srcdir/yandex-music-linux/templates/default.conf" "$pkgdir/usr/lib/yandex-music/default.conf"
sed -i "s|%electron_path%|/usr/bin/electron29|g" "$pkgdir/usr/lib/yandex-music/default.conf"
install -Dm644 "$srcdir/yandex-music-linux/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# Create a script to launch the app with Electron
echo "#!/bin/sh" > "$pkgdir/usr/bin/yandex-music"
echo 'exec electron29 /usr/lib/yandex-music/yandex-music.asar "$@"' >> "$pkgdir/usr/bin/yandex-music"
chmod 755 "$pkgdir/usr/bin/yandex-music"
install -Dm755 "$srcdir/yandex-music-linux/templates/yandex-music.sh" "$pkgdir/usr/bin/yandex-music"
}

2
templates/default.conf Normal file
View File

@@ -0,0 +1,2 @@
ELECTRON_BIN=%electron_path%
ELECTRON_ARGS="--no-sandbox"

28
templates/yandex-music.sh Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -e
CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
CONFIG_FILE="${YANDEX_MUSIC_CONFIG:-$CONFIG_HOME/yandex-music.conf}"
echo "Using config file: ${CONFIG_FILE}"
if [ ! -f "$CONFIG_FILE" ]; then
echo "Config file not found, copying default"
mkdir -p "$(dirname "$CONFIG_FILE")"
cp /usr/lib/yandex-music/default.conf "$CONFIG_FILE"
fi
source "$CONFIG_FILE"
WAYLAND_FLAGS=""
if [ "$XDG_SESSION_TYPE" == "wayland" ]; then
WAYLAND_FLAGS="--enable-features=UseOzonePlatform --ozone-platform=wayland"
fi
if [ -z "$ELECTRON_BIN" ]; then
echo "ELECTRON_BIN is not set"
exit 1
fi
exec "${ELECTRON_BIN}" "${ELECTRON_ARGS}" "${WAYLAND_FLAGS}" /usr/lib/yandex-music/app.asar