2021-04-04 16:51:01 +00:00
|
|
|
#!/usr/bin/bash
|
|
|
|
# Run wayland compositor and set WAYLAND_DISPLAY env variable
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
echo export DESKTOP_SESSION=gnome > $HOME/.xsessionrc
|
|
|
|
echo export XDG_CURRENT_DESKTOP=GNOME > $HOME/.xsessionrc
|
|
|
|
echo export XDG_SESSION_TYPE=wayland >> $HOME/.xsessionrc
|
|
|
|
|
|
|
|
# Turn off the screen saver and screen locking
|
|
|
|
gsettings set org.gnome.desktop.screensaver idle-activation-enabled false
|
|
|
|
gsettings set org.gnome.desktop.screensaver lock-enabled false
|
|
|
|
gsettings set org.gnome.desktop.screensaver lock-delay 3600
|
|
|
|
|
|
|
|
# Disable the screen saver
|
|
|
|
# This starts the gnome-keyring-daemon with an unlocked login keyring. libsecret uses this to
|
|
|
|
# store secrets. Firefox uses libsecret to store a key that protects sensitive information like
|
|
|
|
# credit card numbers.
|
|
|
|
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
|
|
|
|
# if not found, launch a new one
|
|
|
|
eval `dbus-launch --sh-syntax`
|
|
|
|
fi
|
|
|
|
eval `echo '' | /usr/bin/gnome-keyring-daemon -r -d --unlock --components=secrets`
|
|
|
|
|
|
|
|
if [ -z "$XDG_RUNTIME_DIR" ]; then
|
|
|
|
export XDG_RUNTIME_DIR=$HOME
|
|
|
|
fi
|
|
|
|
|
2024-02-27 11:37:56 +00:00
|
|
|
export WAYLAND_DISPLAY=firefox-pgo-wayland-0
|
2024-02-23 18:31:52 +00:00
|
|
|
if [ -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; then
|
|
|
|
rm -f $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY
|
2024-02-27 11:37:56 +00:00
|
|
|
rm -f $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY.lock
|
2021-04-04 16:51:01 +00:00
|
|
|
fi
|
2024-02-23 18:31:52 +00:00
|
|
|
|
|
|
|
echo "Launch mutter for $WAYLAND_DISPLAY"
|
2024-02-27 11:37:56 +00:00
|
|
|
xvfb-run -s "-screen 0 1600x1200x24" mutter --nested --wayland --wayland-display=$WAYLAND_DISPLAY & MUTTER_PID=$!
|
2024-02-23 18:31:52 +00:00
|
|
|
export MUTTER_PID
|
|
|
|
echo "Mutter PID $MUTTER_PID"
|
|
|
|
|
|
|
|
echo "Waiting for mutter to start..."
|
|
|
|
sleep 5
|
2021-04-04 16:51:01 +00:00
|
|
|
retry_count=0
|
|
|
|
max_retries=5
|
|
|
|
until [ $retry_count -gt $max_retries ]; do
|
|
|
|
if [ -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; then
|
|
|
|
retry_count=$(($max_retries + 1))
|
|
|
|
else
|
|
|
|
retry_count=$(($retry_count + 1))
|
|
|
|
echo "Waiting for Mutter, retry: $retry_count"
|
|
|
|
sleep 2
|
|
|
|
fi
|
|
|
|
done
|
2021-04-27 12:35:17 +00:00
|
|
|
|
2024-02-27 11:37:56 +00:00
|
|
|
if [ ! -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; then
|
|
|
|
echo "Mutter failed to start!"
|
|
|
|
exit 1
|
2024-02-23 18:31:52 +00:00
|
|
|
fi
|
2024-02-27 11:37:56 +00:00
|
|
|
|
|
|
|
echo "Mutter is running, $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY is here."
|
|
|
|
|