Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add snap config item for tray-icon; disable by default #200

Merged
merged 2 commits into from
Nov 25, 2023
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: 11 additions & 0 deletions snap/hooks/configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail

# On Fedora $SNAP is under /var and there is some magic to map it to /snap.
# We need to handle that case and reset $SNAP
SNAP="${SNAP//\/var\/lib\/snapd/}"

tray_icon="$(snapctl get tray-icon)"
if [[ -z "$tray_icon" ]]; then
snapctl set tray-icon=false
fi
19 changes: 19 additions & 0 deletions snap/local/usr/bin/signal-desktop-wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail

# Run the configure hook which sets defaults for any config options
"${SNAP}/snap/hooks/configure"

# Grab the config options
tray_icon="$(snapctl get tray-icon)"

# Define an array of command line options
opts=()

# If the the tray icon is enabled, add to the list of command line args
if [[ "${tray_icon}" == "true" ]]; then
opts+=("--use-tray-icon")
fi

# Run signal-desktop with the gathered arguments
exec "${SNAP}/opt/Signal/signal-desktop" "--no-sandbox" "${opts[@]}" "$@"
7 changes: 6 additions & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ parts:
- -opt/Signal/resources/app.asar.unpacked/node_modules/sharp/vendor/lib
- -opt/Signal/resources/app.asar.unpacked/node_modules/sharp/vendor/include

local-parts:
plugin: dump
source: ./snap/local
source-type: local

cleanup:
after: [signal-desktop]
plugin: nil
Expand All @@ -219,7 +224,7 @@ parts:
apps:
signal-desktop:
extensions: [gnome]
command: opt/Signal/signal-desktop --use-tray-icon --no-sandbox
command: usr/bin/signal-desktop-wrapper
plugs:
- browser-support
- camera
Expand Down
Loading