Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: sound on ubuntu with snapcraft #143

Merged
merged 4 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/snapcraft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v4
- uses: canonical/action-build@v1
id: snapcraft
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: snap
path: ${{ steps.snapcraft.outputs.snap }}
58 changes: 43 additions & 15 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,37 @@ grade: stable
confinement: strict

layout:
/usr/lib/$CRAFT_ARCH_TRIPLET/webkit2gtk-4.1:
bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/webkit2gtk-4.1
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1:
bind: $SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1
/usr/lib/pomodorolm:
symlink: $SNAP/usr/lib/pomodorolm
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/alsa-lib:
bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/alsa-lib
/usr/share/alsa:
bind: $SNAP/usr/share/alsa

apps:
pomodorolm:
command: usr/bin/pomodorolm
command-chain:
- bin/gpu-2404-wrapper
- snap/command-chain/alsa-launch
desktop: usr/share/applications/pomodorolm.desktop
extensions: [gnome]
extensions:
- gnome
environment:
ALSA_CONFIG_PATH: "$SNAP/etc/asound.conf"
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/blas:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/lapack:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/samba:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/vdpau:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/dri
ALWAYS_USE_PULSEAUDIO: "1"
plugs:
- home
- browser-support
- network
- network-status
- gsettings
- pulseaudio
- desktop
- opengl
# Add whatever plugs you need here, see https://snapcraft.io/docs/snapcraft-interfaces for more info.
# The gnome extension already includes [ desktop, desktop-legacy, gsettings, opengl, wayland, x11, mount-observe, calendar-service ]
- alsa
- audio-playback

package-repositories:
- type: apt
Expand All @@ -48,6 +56,8 @@ package-repositories:
parts:
build-app:
plugin: dump
after:
- alsa-mixin
build-snaps:
- node/20/stable
- rustup/latest/stable
Expand All @@ -66,12 +76,6 @@ parts:
stage-packages:
- libwebkit2gtk-4.1-0
- libayatana-appindicator3-1
- libasound2
- libpulse0
- libasound2-plugins
- liboss4-salsa2

# For pulse/alsa see: https://forum.snapcraft.io/t/help-needed-with-bombsquad-snap/36744/2

source: .

Expand All @@ -80,12 +84,36 @@ parts:
npm install
rustup default stable
npm run tauri build -- --bundles deb
cp snapcraft/asound.conf $SNAPCRAFT_PART_INSTALL/etc/
dpkg -x src-tauri/target/release/bundle/deb/*.deb $SNAPCRAFT_PART_INSTALL/
sed -i -e "s|Icon=pomodorolm|Icon=/usr/share/icons/hicolor/32x32/apps/pomodorolm.png|g" $SNAPCRAFT_PART_INSTALL/usr/share/applications/pomodorolm.desktop

alsa-mixin:
plugin: dump
source: https://github.com/diddlesnaps/snapcraft-alsa.git
source-subdir: snapcraft-assets
build-packages:
- libasound2-dev
stage-packages:
- libasound2-plugins
- yad
stage:
- etc/asound.conf
- snap/command-chain/alsa-launch
- usr/bin/yad*
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/alsa-lib
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libasound*
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libdnsfile*
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libFLAC*
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libjack*
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libpulse*
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libsamplerate*
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libspeex*
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvorbis*
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pulseaudio

gpu-2404:
after: [build-app]
after:
- build-app
source: https://github.com/canonical/gpu-snap.git
plugin: dump
override-prime: |
Expand Down
12 changes: 0 additions & 12 deletions snapcraft/asound.conf

This file was deleted.

Loading