Use Synfig in a Web Browser with Broadway!

Today I wanted to try Broadway for the fun.
This is a display server packaged with GTK allowing display of a GTK app in a Web Browser.

I was remembering some topics about JS or Android versions, and I was proposing RDP/VNC alternative.

But there is a more simple solution.
Sadely yet I didn’t find a way to use directly AppImage binary (neither by extraction), so you would have to compile Synfig yourself and make reference to that build on the following script.

For example, I can reach it at http://192.168.0.21:3131 with a tablet and a Bluetooth mouse.
Have fun!

Gist

#!/bin/bash
# Access SynfigStudio from your web browser at the address http://IP:PORT
# You can use for example a Tablet with a BlueTooth mouse
# Note: You may have to open the port in your firewall to access it from another device

IP=192.168.0.21 # The Ip of your interface
PORT=3131       # The Port
B_DISPLAY=:5    # A display number, 5 should be fine

# You can select a theme or let it empty for the default theme
# THEME=
# THEME=Adwaita:dark
THEME=Adwaita

# The path and name of your SynfigStudio build
BUILD_BASE=~/sources/synfig/_production/build # Depends on your system
BINARY=bin/synfigstudio                       # This should be untouched

# Don't modify below -------------------------------------------------
RUN_BROADWAYD="broadwayd --address=$IP --port=$PORT $B_DISPLAY"

# Start Broadway server
$RUN_BROADWAYD & </dev/null >/dev/null 2>&1
PID_BROADWAYD=$!

PWD=`pwd`
cd $BUILD_BASE
  GDK_BACKEND=broadway BROADWAY_DISPLAY=$B_DISPLAY GTK_THEME=$THEME $BINARY
cd $PWD

# Kill Broadway server
if ps -p $PID_BROADWAYD >/dev/null
then
  kill $PID_BROADWAYD >/dev/null || true
fi

Edit: Added GTK THEME selection and modified for _production

4 Likes

Woah! This is so cool!

I suggest to replace

BUILD_BASE=~/sources/synfig/_debug/build

to

BUILD_BASE=~/sources/synfig/_production/build

to encourage users use non-debug builds (as they are faster). :wink:

1 Like