Hello, I need to enable my snap to be able to show a customized icon in the system tray. I am talking about a Java software which works fine on Ubuntu (.deb package), Windows 11 and MacOS. When I try to execute it as a snap file, it is not able to identify the System Tray, so the application terminates. The system tray is essential for this program, because I need to execute the application as a daemon and show the current job status (statuses: is working or in idle mode). I asked some AI ad they provided several useless/obsolete plugs for my .yml file, which are not working.
How I can allow to my snap to āseeā the system tray?
Thank you, Andrei
P.S. this is my yaml file:
name: fromgtog
version: '9.0.6'
summary: Clone ALL GitHub/Gitea/Gitlab/Local to GitHub/Gitea/Gitlab/Local.
description: |
Helps to clone all repositories from GitHub on Gitea/Local and vice versa.
grade: stable
confinement: strict
base: core24
icon: snap/gui/icon.png
title: FromGtoG
website: https://andre-i.eu
issues: https://github.com/goto-eof
source-code: https://github.com/goto-eof/fromgtog
donation: https://github.com/sponsors/goto-eof
contact: https://andre-i.eu/#contactme
compression: lzo
license: CC-BY-NC-4.0
slots:
fromgtog-dbus:
interface: dbus
bus: session
name: it.es5.fromgtog.dbus
apps:
fromgtog:
environment:
ALSA_CONFIG_PATH: $SNAP/etc/asound.conf
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP_DESKTOP_RUNTIME/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libproxy:$SNAP_DESKTOP_RUNTIME/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/gio/modules
command: executor
extensions: [ gnome ]
plugs:
- network
- x11
- browser-support
- unity7
- home
- desktop
- desktop-legacy
- removable-media
- wayland
- network-bind
- audio-playback
- alsa
slots:
- fromgtog-dbus
platforms:
amd64:
build-on: [ amd64 ]
build-for: [ amd64 ]
arm64:
build-on: [ arm64 ]
build-for: [ arm64 ]
parts:
wrapper:
plugin: dump
source: snap/local
source-type: local
alsa-config:
plugin: dump
source: snap/local/asound.conf
source-type: file
organize:
asound.conf: etc/asound.conf
prime:
- etc/asound.conf
application:
plugin: maven
source: .
build-packages:
- openjdk-21-jdk
- maven
- sed
override-build: |
getproxy () {
host=$(echo "$1" | sed -E 's|https?://([^:/]*):?[0-9]*/?|\1|')
port=$(echo "$1" | sed -E 's|https?://[^:/]*:?([0-9]*)/?|\1|')
}
echo "Starting to build FromGtoG at $(date)"
START_TIME=$(date +%s)
echo "Start building FromGtoG at $(date)"
set -eux
JLINK_JDK_PATH="/usr/lib/jvm/java-21-openjdk-$(dpkg-architecture -q DEB_BUILD_MULTIARCH)"
REQUIRED_MODULES="java.base,java.desktop,java.net.http,java.naming,java.sql,java.management,java.security.jgss,java.xml,java.logging,jdk.crypto.ec,java.security.sasl"
echo "Creating custom JRE runtime with the following modules: $REQUIRED_MODULES"
/usr/bin/jlink \
--add-modules $REQUIRED_MODULES \
--output "$SNAPCRAFT_PART_INSTALL"/usr/lib/jvm/custom-jre \
--compress=2 \
--no-header-files \
--no-man-pages \
--strip-debug
http=""
https=""
if [ -n "${http_proxy:-}" ]; then
getproxy "$http_proxy"
http="-Dhttp.proxyHost=$host -Dhttp.proxyPort=$port"
fi
if [ -n "${https_proxy:-}" ]; then
getproxy "$https_proxy"
https="-Dhttps.proxyHost=$host -Dhttps.proxyPort=$port"
fi
export MAVEN_OPTS="$http $https"
mvn clean install -DskipTests
APP_JAR_NAME="fromgtog.jar"
APP_JAR_PATH="$SNAPCRAFT_PART_BUILD/target/$APP_JAR_NAME"
if [ ! -f "$APP_JAR_PATH" ]; then
echo "ERROR: jar not found in $APP_JAR_PATH"
exit 1
fi
mkdir -p "$SNAPCRAFT_PART_INSTALL"/jar
echo "Directory created: $SNAPCRAFT_PART_INSTALL/jar"
echo "Copying $APP_JAR_NAME in $SNAPCRAFT_PART_INSTALL/jar/fromgtog.jar"
cp "$APP_JAR_PATH" "$SNAPCRAFT_PART_INSTALL"/jar/fromgtog.jar
echo "custom JRE runtime created in $SNAPCRAFT_PART_INSTALL/usr/lib/jvm/custom-jre"
rm -rf "$JLINK_JDK_PATH"
echo "temporary JDK removed."
echo "Finished building FromGtoG at $(date)"
END_TIME=$(date +%s)
echo "Total time: $((${END_TIME} - ${START_TIME})) seconds"
stage-packages:
- glib-networking
- libgtk-3-0
- xdg-utils
- libasound2
- libasound2-plugins
- alsa-utils
after:
- alsa-config
override-prime: |
snapcraftctl prime
