WSL / Bash on Windows to the rescue
I have also talked, a while ago, about the good, the bad, and the ugly part of Bash for Windows, where the main bad point was the missing display.
However, and somehow, developers managed to fill the gap through Xming, a good old Xorg port for windows and cross platform software written for Mac or Linux.
Connecting the dots together, we can assume writing GJS applications on Bash for Windows should be possible, right?
Upgrade Trusty to Xenial
The first thing to do, is to be sure your Ubuntu version is at least the LTS 16.
To know which version is it, type the following in the console and read the output:
If it says 14 or “trusty” anywhere, you need to follow the only procedure that actually worked for me, found through this ticket.
Follow the instructions, and if once finished, closed, and reopened Bash you have issues, have a look at these two possible solutions. The one that worked for me was the following one, performed from the Command Prompt:
lxrun /setdefaultuser root
You should now be able to start Bash and do
apt-get updateand other operations to be sure you have the latest.
If there’s some warning about some ignored file, feel free to ignore, or actually remove it.
Installing GJS and WebKit2GTK
Without being too picky about what exact module should go in or not, I’ve managed to obtain all the packages I needed installing the following:
sudo apt-get install libgtk3.0 libwebkit2gtk-4.0 gir1.2-gtk-3 gobject-introspection gjs
Theoretically, we could already use
gjsbut if we want to see something, we’ll need a
echo $DISPLAYto be sure there isn’t one already, and in such case add the display to your user env.
echo 'export DISPLAY=:0.0' >> ~/.bashrc
You can now restart bash or simply type
export DISPLAY=:0.0and move on … but …
If you haven’t installed it yet, this is the right time or nothing could possibly work today. I’ve left the configuration with all defaults and it should just work so … feel free to do the same.
You need to launch Xming before trying to use anything graphical on WSL.
You can simply
curlthe “hello world” or write it yourself, it’s that simple:
You can launch it directly as executable after a
chmod a+x helloor simply launch through
If you don’t see the widget on top of the others, look your system bar, I’m sure something is blinking asking for attention.
Trying WebKit2GTK in all its glory
Well, to be honest, GNOME Web, once known as Epiphany, already uses the latest WebKit2 engine, so installing it would be one option.
Another one is to bring a frame-less quick tester, or the same browser I’ve written in my old post, slightly re-adapted to use WebKit2 instead of WK1.
These are both on GitHub, but you can simply grab them via archibold.io.
curl -LO archibold.io/test/gjs/browser-bar