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