Skip to content

Commit 08782c7

Browse files
committed
snap: Run as native wayland client if possible
The new electron versions support wayland natively, this implies that mailspring can use the native rendering when in a wayland desktop environment, bringing various benefits including a better rendering in high DPI displays. To enable this electron still requires some flags, so add a wrapper launcher that is used to enable them unless wayland isn't explicitly disabled.
1 parent 9a7e1a7 commit 08782c7

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

snap/launcher

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
if [ -n "$WAYLAND_DISPLAY" ] && \
4+
[ "${DISABLE_WAYLAND:-0}" = 0 ] && \
5+
[ "${GDK_BACKEND:-wayland}" = "wayland" ]; then
6+
args="--enable-features=WaylandWindowDecorations --ozone-platform=wayland --use-gl=desktop"
7+
fi
8+
9+
exec "$SNAP/usr/bin/mailspring" $args "${@}"

snap/snapcraft.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ parts:
1919
override-build: |
2020
cp -a "$CRAFT_PART_SRC"/* "$CRAFT_PART_INSTALL"
2121
craftctl default
22+
install -m 755 ${CRAFT_PROJECT_DIR}/snap/launcher \
23+
-D ${CRAFT_PART_INSTALL}/bin/mailspring.launcher -v
2224
sed -i 's|Icon=mailspring|Icon=/usr/share/pixmaps/mailspring\.png|' \
2325
$CRAFT_PART_INSTALL/usr/share/applications/Mailspring.desktop
2426
prime:
@@ -44,7 +46,7 @@ parts:
4446

4547
apps:
4648
mailspring:
47-
command: usr/bin/mailspring --no-sandbox
49+
command: bin/mailspring.launcher --no-sandbox
4850
common-id: mailspring
4951
desktop: usr/share/applications/Mailspring.desktop
5052
extensions: [gnome]
@@ -53,8 +55,6 @@ apps:
5355
# Correct the TMPDIR path for Chromium Framework/Electron to
5456
# ensure libappindicator has readable resources.
5557
TMPDIR: $XDG_RUNTIME_DIR
56-
# Fallback to XWayland if running in a Wayland session.
57-
DISABLE_WAYLAND: 1
5858
plugs:
5959
- avahi-observe
6060
- browser-support
@@ -69,3 +69,4 @@ apps:
6969
- pulseaudio
7070
- unity7
7171
- x11
72+
- wayland

0 commit comments

Comments
 (0)