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