Skip to content

Commit

Permalink
Improve the startwayfre script
Browse files Browse the repository at this point in the history
Signed-off-by: kernaltrap <[email protected]>
  • Loading branch information
kernaltrap8 committed Jul 21, 2024
1 parent 270a5a7 commit b96dce8
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions start_wayfire.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,31 @@
# 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
# wayfire start command
WAYFIRE_START="dbus-run-session wayfire"
# check if we have dbus capability
if ! [[ -e "$(which dbus-run-session)" ]]; then
WAYFIRE_START="wayfire"
fi

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
if ! mkdir -p "$DEFAULT_LOG_DIR"; then
echo "Could not create log directory $DEFAULT_LOG_DIR"
echo "Using stdout as log"
wayfire "$@"
elif [ ! -z "$WAYLAND_DISPLAY" ] || [ ! -z "$DISPLAY" ]; then
"$WAYFIRE_START" "$@"
elif [ -n "$WAYLAND_DISPLAY" ] || [ -n "$DISPLAY" ]; then
echo "Running nested, using stdout as log"
wayfire "$@"
"$WAYFIRE_START" "$@"
else
LOG_FILE=$DEFAULT_LOG_DIR/wayfire.log
if [ -f $LOG_FILE ]; then
cp $LOG_FILE $LOG_FILE.old
if [ -f "$LOG_FILE" ]; then
cp "$LOG_FILE" "$LOG_FILE.old"
fi
echo "Using log file: $LOG_FILE"
wayfire "$@" &> $LOG_FILE
"$WAYFIRE_START" "$@" &> "$LOG_FILE"
fi

0 comments on commit b96dce8

Please sign in to comment.