0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-23 14:12:59 +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

@ -19,7 +19,7 @@ jobs:
image: archlinux:latest
steps:
- name: Install packages
run: pacman -Syy -q --noconfirm && pacman -S --noconfirm git sudo base-devel p7zip nodejs jq asar electron29 libpulse dpkg unzip xdg-utils python rpm-tools
run: pacman -Syy -q --noconfirm && pacman -S -q --noconfirm git sudo base-devel p7zip nodejs jq asar electron29 libpulse dpkg unzip xdg-utils python rpm-tools
- name: Checkout
uses: actions/checkout@v4
with:

View File

@ -36,12 +36,12 @@ build_tarball(){
install -Dm644 "${TEMPDIR}/app/favicon.svg" "${app_dir}/usr/share/icons/hicolor/scalable/apps/yandex-music.svg"
install -Dm644 "./templates/desktop" "${app_dir}/usr/share/applications/yandex-music.desktop"
install -Dm644 "./templates/default.conf" "${app_dir}/usr/lib/yandex-music/default.conf"
sed -i "s|%electron_path%|/usr/lib/yandex-music/electron/electron|g" "${app_dir}/usr/lib/yandex-music/default.conf"
install -Dm644 "./LICENSE.md" "${app_dir}/usr/share/licenses/yandex-music/LICENSE"
mv "${TEMPDIR}/electron-${arch}/" "${app_dir}/usr/lib/yandex-music/electron"
echo "#!/bin/sh" > "${app_dir}/usr/bin/yandex-music"
echo 'exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar "$@"' >> "${app_dir}/usr/bin/yandex-music"
chmod 755 "${app_dir}/usr/bin/yandex-music"
install -Dm755 "./templates/yandex-music.sh" "${app_dir}/usr/bin/yandex-music"
cd "${app_dir}"
tar -czf "${OUTPUT_DIR}/yandex-music_${version}_${arch}.tar.gz" *

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