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

snap: Run as native wayland client if possible #2480

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions snap/hooks/configure
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions snap/launcher
Original file line number Diff line number Diff line change
@@ -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 "${@}"
7 changes: 4 additions & 3 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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]
Expand All @@ -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
Expand All @@ -69,3 +69,4 @@ apps:
- pulseaudio
- unity7
- x11
- wayland