-
Notifications
You must be signed in to change notification settings - Fork 13
/
emacs
executable file
·38 lines (30 loc) · 1.03 KB
/
emacs
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
30
31
32
33
34
35
36
37
#!/bin/bash
# Launch emacs with the most appropriate toolkit (currently gtk (for real x11)
# or wayland)
# The environment variable EMACS_TOOLKIT can be used to specify the preferred toolkit.
# The value should be one of: gtk or wayland
# If the environment variable is not set, the script will try to detect the
# toolkit to use by checking if the XDG_SESSION_TYPE environment variable is
# set to wayland or x11.
# FIXME - remove the following once the various issues like
# https://github.com/alexmurray/emacs-snap/issues/78 and
# https://github.com/alexmurray/emacs-snap/issues/79 are resolved
: "${EMACS_TOOLKIT:=gtk}"
if [ -n "${XDG_SESSION_TYPE}" ]; then
if [ "${XDG_SESSION_TYPE}" = "wayland" ]; then
: "${EMACS_TOOLKIT:=wayland}"
else
: "${EMACS_TOOLKIT:=gtk}"
fi
else
: "${EMACS_TOOLKIT:=gtk}"
fi
case "${EMACS_TOOLKIT}" in
gtk|wayland)
;;
*)
echo "Invalid value for EMACS_TOOLKIT: ${EMACS_TOOLKIT} - must be either gtk or wayland"
exit 1
;;
esac
exec "$SNAP/usr/bin/emacs-${EMACS_TOOLKIT}" "$@"