-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathstart-siyuan.sh
executable file
·47 lines (37 loc) · 1.7 KB
/
start-siyuan.sh
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
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -oue pipefail
WORKSPACE_CONFIG_FILE="$HOME/.config/siyuan/workspace.json"
# Creating default workspace configuration when first time opening SiYuan
# then Siyuan will initialize directly.
#
# For users who installed SiYuan, please copy folder `~/SiYuan` in host
# to `~/.var/app/org.b3log.siyuan/SiYuan` to recover your data, but dont
# forget to clean up `~/.var/app/org.b3log.siyuan/SiYuan` to empty at first.
if [ ! -s "$WORKSPACE_CONFIG_FILE" ]; then
echo "[\"$HOME/SiYuan\"]" > "$WORKSPACE_CONFIG_FILE";
# Sending a notification to notice user
# where they can export documents at the first time start.
NOTIFICATION_BODY='You can only export documents such as pdf '\
'to ~/Desktop, ~/Downloads and ~/Documents due to the Flakpak sandbox '\
'limitation.'
notify-send "⚠️ Warning" "$NOTIFICATION_BODY"
fi
EXTRA_ARGS=(--enable-features=Vulkan)
# Wayland support can be optionally enabled like so:
# flatpak override --user --socket=wayland org.b3log.siyuan
WL_DISPLAY="${WAYLAND_DISPLAY:-"wayland-0"}"
# Some compositors a real path a instead of a symlink for WAYLAND_DISPLAY:
# https://github.com/flathub/md.obsidian.Obsidian/issues/284
if [[ -e "${XDG_RUNTIME_DIR}/${WL_DISPLAY}" || -e "/${WL_DISPLAY}" ]]; then
echo "Debug: Enabling Wayland backend"
EXTRA_ARGS+=(
--ozone-platform-hint=auto
--enable-features=UseOzonePlatform,WaylandWindowDecorations
--enable-wayland-ime
)
fi
echo "Debug: Will run Siyuan with the following arguments: ${EXTRA_ARGS[@]}"
echo "Debug: Additionally, user gave: $@"
export FLATPAK_ID="${FLATPAK_ID:-org.b3log.siyuan}"
export TMPDIR="${XDG_RUNTIME_DIR}/app/${FLATPAK_ID}"
zypak-wrapper /app/siyuan/siyuan $@ ${EXTRA_ARGS[@]}