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 autostart after multiple snap updates #127

Merged
merged 4 commits into from
Aug 6, 2022
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
11 changes: 6 additions & 5 deletions snap/local/launch.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/sh

# Make sure a link to desktop launcher is added to the autostart dir
autostart_dir="$SNAP_USER_DATA/.config/autostart"
if [ ! -d "$autostart_dir" ]; then
mkdir -p "$autostart_dir"
ln -sfnt "$autostart_dir/" "$SNAP/share/applications/indicator-sound-switcher.desktop"
fi

AUTOSTART="$SNAP_USER_DATA/.config/autostart/"

mkdir -p "$AUTOSTART"

ln -sfnt "$AUTOSTART" "$SNAP/share/applications/indicator-sound-switcher.desktop"

exec "$@"
8 changes: 4 additions & 4 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ description: |

icon: icons/indicator-sound-switcher.svg
license: GPL-3.0
grade: stable
confinement: strict

apps:
Expand All @@ -29,7 +30,6 @@ apps:
parts:
indicator-sound-switcher:
plugin: python
python-version: python3
source: .
build-packages:
- gettext
Expand All @@ -46,8 +46,8 @@ parts:

# Use version from setup.py
version="$(sed -ne 's/\s*APP_VERSION\s*=\s*\x27\([^\x27]\+\)\x27.*/\1/p' setup.py)"

snapcraftctl set-version "$version"
snapcraftctl set-grade "stable"

# Fix icon path in the .desktop
sed -i -E 's!^Icon=.*!Icon=/usr/share/icons/hicolor/scalable/status/indicator-sound-switcher.svg!' indicator-sound-switcher.desktop
Expand All @@ -59,5 +59,5 @@ parts:
icons: usr/share/icons/hicolor/scalable/status
snap/local/launch.sh: bin/
stage:
- usr/
- bin/
- usr/*
- bin/*