diff --git a/snap/hooks/configure b/snap/hooks/configure new file mode 100644 index 0000000000..75f3aad439 --- /dev/null +++ b/snap/hooks/configure @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -eu + +wayland_native="$(snapctl get wayland-native)" +if [[ -z "$wayland_native" ]]; then + snapctl set wayland-native=false +fi diff --git a/snap/launcher b/snap/launcher new file mode 100644 index 0000000000..dc97ff46cf --- /dev/null +++ b/snap/launcher @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "${DISABLE_WAYLAND:-0}" = 0 ] && \ + [ "${GDK_BACKEND:-wayland}" = "wayland" ] && \ + [ "$(snapctl get wayland-native)" = "true" ]; then + args="--enable-features=WaylandWindowDecorations --ozone-platform=wayland --use-gl=desktop" +fi + +exec "$SNAP/usr/bin/mailspring" $args "${@}" diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 016b4daa79..8074b736a3 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -19,6 +19,8 @@ parts: override-build: | cp -a "$CRAFT_PART_SRC"/* "$CRAFT_PART_INSTALL" craftctl default + install -m 755 ${CRAFT_PROJECT_DIR}/snap/launcher \ + -D ${CRAFT_PART_INSTALL}/bin/mailspring.launcher -v sed -i 's|Icon=mailspring|Icon=/usr/share/pixmaps/mailspring\.png|' \ $CRAFT_PART_INSTALL/usr/share/applications/Mailspring.desktop prime: @@ -44,7 +46,7 @@ parts: apps: mailspring: - command: usr/bin/mailspring --no-sandbox + command: bin/mailspring.launcher --no-sandbox common-id: mailspring desktop: usr/share/applications/Mailspring.desktop extensions: [gnome] @@ -53,8 +55,6 @@ apps: # Correct the TMPDIR path for Chromium Framework/Electron to # ensure libappindicator has readable resources. TMPDIR: $XDG_RUNTIME_DIR - # Fallback to XWayland if running in a Wayland session. - DISABLE_WAYLAND: 1 plugs: - avahi-observe - browser-support @@ -69,3 +69,4 @@ apps: - pulseaudio - unity7 - x11 + - wayland