aboutsummaryrefslogtreecommitdiffstats
path: root/typora-bin/typora.sh
diff options
context:
space:
mode:
Diffstat (limited to 'typora-bin/typora.sh')
-rw-r--r--typora-bin/typora.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/typora-bin/typora.sh b/typora-bin/typora.sh
new file mode 100644
index 0000000..9ecdf48
--- /dev/null
+++ b/typora-bin/typora.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Launcher for the bundled Typora Electron binary.
+#
+# Under Wayland, Electron still defaults to XWayland unless told otherwise,
+# which costs sharp HiDPI scaling and native input methods. Auto-enable the
+# Ozone Wayland backend when a Wayland session is detected, and stay on the
+# default (X11) path otherwise, so one package works in both sessions.
+#
+# Override either way with TYPORA_OZONE=wayland or TYPORA_OZONE=x11.
+
+APPDIR=/opt/Typora-linux-x64
+
+ozone=${TYPORA_OZONE:-auto}
+if [ "$ozone" = auto ]; then
+ if [ -n "$WAYLAND_DISPLAY" ]; then
+ ozone=wayland
+ else
+ ozone=x11
+ fi
+fi
+
+if [ "$ozone" = wayland ]; then
+ exec "$APPDIR/Typora" --enable-features=UseOzonePlatform \
+ --ozone-platform=wayland "$@"
+fi
+
+exec "$APPDIR/Typora" "$@"