Skip to content

Commit

Permalink
Merge pull request #200 from jnsgruk/tray-icon-config
Browse files Browse the repository at this point in the history
feat: add snap config item for tray-icon; disable by default
  • Loading branch information
merlijn-sebrechts authored Nov 25, 2023
2 parents a266f78 + 8412f04 commit 6cdc284
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
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

0 comments on commit 6cdc284

Please sign in to comment.