aboutsummaryrefslogtreecommitdiffstats
path: root/typora-bin/typora.sh
blob: 4f56585e7fd09ffd4762002922501acbbf417683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/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@ is substituted by the SlackBuild at build time (it carries the
# package version, so it must not be hardcoded here).
APPDIR=@APPDIR@

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" "$@"