9869746
#!/usr/bin/bash
9869746
# Run wayland compositor and set WAYLAND_DISPLAY env variable
9869746
9869746
set -x
9869746
9869746
echo export DESKTOP_SESSION=gnome > $HOME/.xsessionrc
9869746
echo export XDG_CURRENT_DESKTOP=GNOME > $HOME/.xsessionrc
9869746
echo export XDG_SESSION_TYPE=wayland >> $HOME/.xsessionrc
9869746
9869746
# Turn off the screen saver and screen locking
9869746
gsettings set org.gnome.desktop.screensaver idle-activation-enabled false
9869746
gsettings set org.gnome.desktop.screensaver lock-enabled false
9869746
gsettings set org.gnome.desktop.screensaver lock-delay 3600
9869746
9869746
# Disable the screen saver
9869746
# This starts the gnome-keyring-daemon with an unlocked login keyring. libsecret uses this to
9869746
# store secrets. Firefox uses libsecret to store a key that protects sensitive information like
9869746
# credit card numbers.
9869746
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
9869746
    # if not found, launch a new one
9869746
    eval `dbus-launch --sh-syntax`
9869746
fi
9869746
eval `echo '' | /usr/bin/gnome-keyring-daemon -r -d --unlock --components=secrets`
9869746
9869746
if [ -z "$XDG_RUNTIME_DIR" ]; then
9869746
  export XDG_RUNTIME_DIR=$HOME
9869746
fi
9869746
fcf7279
. xvfb-run -s "-screen 0 1600x1200x24" -n 80 mutter --display=:80 --wayland --nested &
fcf7279
export DISPLAY=:80
9869746
9869746
if [ -z "$WAYLAND_DISPLAY" ] ; then
9869746
  export WAYLAND_DISPLAY=wayland-0
9869746
else
9869746
  export WAYLAND_DISPLAY=wayland-1
9869746
fi
9869746
sleep 10
9869746
retry_count=0
9869746
max_retries=5
9869746
until [ $retry_count -gt $max_retries ]; do
9869746
  if [ -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; then
9869746
    retry_count=$(($max_retries + 1))
9869746
  else
9869746
    retry_count=$(($retry_count + 1))
9869746
    echo "Waiting for Mutter, retry: $retry_count"
9869746
    sleep 2
9869746
  fi
9869746
done
fcf7279
fcf7279
env | grep "DISPLAY"