-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAppRun
55 lines (42 loc) · 2.41 KB
/
AppRun
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
48
49
50
51
52
53
54
55
#! /bin/bash
# Copyright 2020 Alex Woroschilow (alex.woroschilow@gmail.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#set -ex
#=== From linuxdeploy-plugin-gtk.sh
gsettings get org.gnome.desktop.interface gtk-theme 2> /dev/null | grep -qi "dark" && GTK_THEME_VARIANT="dark" || GTK_THEME_VARIANT="light"
APPIMAGE_GTK_THEME="${APPIMAGE_GTK_THEME:-"Adwaita:$GTK_THEME_VARIANT"}" # Allow user to override theme (discouraged)
CACHEDIR="$(mktemp --tmpdir --directory .AppRun.XXXXXXXX)"
export APPDIR="${APPDIR:-"$(dirname "$(realpath "$0")")"}" # Workaround to run extracted AppImage
export GTK_DATA_PREFIX="$APPDIR"
export GTK_THEME="$APPIMAGE_GTK_THEME" # Custom themes are broken
export GDK_BACKEND=x11 # Crash with Wayland backend on Wayland
export XDG_DATA_DIRS="$APPDIR/usr/share:$XDG_DATA_DIRS" # g_get_system_data_dirs() from GLib
export GSETTINGS_SCHEMA_DIR="$APPDIR/usr/share/glib-2.0/schemas"
export GTK_EXE_PREFIX="$APPDIR/usr"
export GTK_PATH="$APPDIR/usr/lib/gtk-3.0"
export GTK_IM_MODULE_DIR="$APPDIR/usr/lib/gtk-3.0/3.0.0/immodules"
export GTK_IM_MODULE_FILE="$CACHEDIR/immodules.cache"
sed "s|/usr/lib/gtk-3.0|$APPDIR/usr/lib/gtk-3.0|g" "$APPDIR/usr/lib/gtk-3.0/3.0.0/immodules.cache" > "$GTK_IM_MODULE_FILE"
export GDK_PIXBUF_MODULEDIR="$APPDIR/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders"
export GDK_PIXBUF_MODULE_FILE="$CACHEDIR/loaders.cache"
sed "s|/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders|$APPDIR/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders|g" "$APPDIR/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" > "$GDK_PIXBUF_MODULE_FILE"
#=== Workaround to plugins setting in .conf file
# The .conf file is supposed to be into $HOME directory, maybe it should be searched into GTK standard dorectory...
#sed -i 's#=.*#=/tmp/.mount_Geany-xxxxxx/usr/lib/geany#' $HOME/.config/geany/geany.conf
#=== From an old Geany AppImage...
PATH=${PATH}:${APPDIR}/usr/bin
PATH=${PATH}:${APPDIR}/bin
export PATH=${PATH}
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${APPDIR}/usr/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
cd ${APPDIR}/usr/share/geany
exec ${APPDIR}/usr/bin/geany "$@"