forked from WayfireWM/wf-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_wayfire.sh.in
34 lines (30 loc) · 946 Bytes
/
start_wayfire.sh.in
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
#!/bin/bash
# if $XDG_DATA_DIRS is not set, set it to the spec recommended value
[ -z "$XDG_DATA_DIRS" ] && export XDG_DATA_DIRS="/usr/local/share:/usr/share"
# path for wf-config and wlroots
LD_LIBRARY_PATH=$LD_LIBRARY_PATH
# path is needed for wf-shell clients
PATH=$PATH
# path to find .desktop files like wcm
XDG_DATA_DIRS=$XDG_DATA_DIRS
if [ -d "$XDG_DATA_HOME" ]; then
DEFAULT_LOG_DIR=$XDG_DATA_HOME/wayfire
else
DEFAULT_LOG_DIR=$HOME/.local/share/wayfire
fi
mkdir -p $DEFAULT_LOG_DIR
if [ $? != 0 ]; then
echo "Could not create log directory $DEFAULT_LOG_DIR"
echo "Using stdout as log"
wayfire "$@"
elif [ ! -z "$WAYLAND_DISPLAY" ] || [ ! -z "$DISPLAY" ]; then
echo "Running nested, using stdout as log"
wayfire "$@"
else
LOG_FILE=$DEFAULT_LOG_DIR/wayfire.log
if [ -f $LOG_FILE ]; then
cp $LOG_FILE $LOG_FILE.old
fi
echo "Using log file: $LOG_FILE"
wayfire "$@" &> $LOG_FILE
fi