diff options
Diffstat (limited to 'data/game_server/xinitrc')
-rw-r--r-- | data/game_server/xinitrc | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/data/game_server/xinitrc b/data/game_server/xinitrc new file mode 100644 index 0000000..19ac175 --- /dev/null +++ b/data/game_server/xinitrc | |||
@@ -0,0 +1,107 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # fix broken $UID on some system... | ||
4 | if test "x$UID" = "x"; then | ||
5 | if test -x /usr/xpg4/bin/id; then | ||
6 | UID=`/usr/xpg4/bin/id -u`; | ||
7 | else | ||
8 | UID=`id -u`; | ||
9 | fi | ||
10 | fi | ||
11 | |||
12 | # set $XDG_MENU_PREFIX to "xfce-" so that "xfce-applications.menu" is picked | ||
13 | # over "applications.menu" in all Xfce applications. | ||
14 | if test "x$XDG_MENU_PREFIX" = "x"; then | ||
15 | XDG_MENU_PREFIX="xfce-" | ||
16 | export XDG_MENU_PREFIX | ||
17 | fi | ||
18 | |||
19 | # set DESKTOP_SESSION so that one can detect easily if an Xfce session is running | ||
20 | if test "x$DESKTOP_SESSION" = "x"; then | ||
21 | DESKTOP_SESSION="xfce" | ||
22 | export DESKTOP_SESSION | ||
23 | fi | ||
24 | |||
25 | # set XDG_CURRENT_DESKTOP so that Qt 5 applications can identify user set Xfce theme | ||
26 | if test "x$XDG_CURRENT_DESKTOP" = "x"; then | ||
27 | XDG_CURRENT_DESKTOP="XFCE" | ||
28 | export XDG_CURRENT_DESKTOP | ||
29 | fi | ||
30 | |||
31 | # $XDG_CONFIG_HOME defines the base directory relative to which user specific | ||
32 | # configuration files should be stored. If $XDG_CONFIG_HOME is either not set | ||
33 | # or empty, a default equal to $HOME/.config should be used. | ||
34 | if test "x$XDG_CONFIG_HOME" = "x" ; then | ||
35 | XDG_CONFIG_HOME=$HOME/.config | ||
36 | fi | ||
37 | [ -d "$XDG_CONFIG_HOME" ] || mkdir "$XDG_CONFIG_HOME" | ||
38 | |||
39 | # $XDG_CACHE_HOME defines the base directory relative to which user specific | ||
40 | # non-essential data files should be stored. If $XDG_CACHE_HOME is either not | ||
41 | # set or empty, a default equal to $HOME/.cache should be used. | ||
42 | if test "x$XDG_CACHE_HOME" = "x" ; then | ||
43 | XDG_CACHE_HOME=$HOME/.cache | ||
44 | fi | ||
45 | [ -d "$XDG_CACHE_HOME" ] || mkdir "$XDG_CACHE_HOME" | ||
46 | |||
47 | # set up XDG user directores. see | ||
48 | # http://freedesktop.org/wiki/Software/xdg-user-dirs | ||
49 | if command -v xdg-user-dirs-update >/dev/null 2>&1; then | ||
50 | xdg-user-dirs-update | ||
51 | fi | ||
52 | |||
53 | # For now, start with an empty list | ||
54 | XRESOURCES="" | ||
55 | |||
56 | # Has to go prior to merging Xft.xrdb, as its the "Defaults" file | ||
57 | test -r "/etc/xdg/xfce4/Xft.xrdb" && XRESOURCES="$XRESOURCES /etc/xdg/xfce4/Xft.xrdb" | ||
58 | test -r $HOME/.Xdefaults && XRESOURCES="$XRESOURCES $HOME/.Xdefaults" | ||
59 | |||
60 | BASEDIR=$XDG_CONFIG_HOME/xfce4 | ||
61 | if test -r "$BASEDIR/Xft.xrdb"; then | ||
62 | XRESOURCES="$XRESOURCES $BASEDIR/Xft.xrdb" | ||
63 | elif test -r "$XFCE4HOME/Xft.xrdb"; then | ||
64 | mkdir -p "$BASEDIR" | ||
65 | cp "$XFCE4HOME/Xft.xrdb" "$BASEDIR"/ | ||
66 | XRESOURCES="$XRESOURCES $BASEDIR/Xft.xrdb" | ||
67 | fi | ||
68 | |||
69 | # merge in X cursor settings | ||
70 | test -r "$BASEDIR/Xcursor.xrdb" && XRESOURCES="$XRESOURCES $BASEDIR/Xcursor.xrdb" | ||
71 | |||
72 | # ~/.Xresources contains overrides to the above | ||
73 | test -r "$HOME/.Xresources" && XRESOURCES="$XRESOURCES $HOME/.Xresources" | ||
74 | |||
75 | # load all X resources (adds /dev/null to avoid an empty list that would hang the process) | ||
76 | cat /dev/null $XRESOURCES | xrdb -merge - | ||
77 | |||
78 | # load local modmap | ||
79 | test -r $HOME/.Xmodmap && xmodmap $HOME/.Xmodmap | ||
80 | |||
81 | # if XAUTHLOCALHOSTNAME is not set in systemd user session, starting of xfce4-notifyd, DISPLAY etc. will fail | ||
82 | if command -v systemctl >/dev/null 2>&1 && systemctl --user list-jobs >/dev/null 2>&1; then # user session is running | ||
83 | dbus-update-activation-environment --systemd XAUTHLOCALHOSTNAME=$XAUTHLOCALHOSTNAME | ||
84 | fi | ||
85 | |||
86 | |||
87 | # check if we start xfce4-session with ck-launch-session. this is only | ||
88 | # required for starting from a console, not a login manager | ||
89 | if test "x$XFCE4_SESSION_WITH_CK" = "x1"; then | ||
90 | if command -v ck-launch-session >/dev/null 2>&1; then | ||
91 | exec ck-launch-session xfce4-session | ||
92 | else | ||
93 | echo | ||
94 | echo "You have tried to start Xfce with consolekit support, but" | ||
95 | echo "ck-launch-session is not installed." | ||
96 | echo "Aborted startup..." | ||
97 | echo | ||
98 | exit 1 | ||
99 | fi | ||
100 | else | ||
101 | # start xfce4-session normally | ||
102 | systemctl --user start sunshine | ||
103 | exec xfce4-session | ||
104 | fi | ||
105 | |||
106 | # if we got here, then exec failed | ||
107 | exit 1 | ||