Gnome 3 on bash on Ubuntu on Windows

19,286

Solution 1

I've just tested Gnome 3 and it doesn't look like it will be easy to get that running, however I currently have a dual task-bar set up on my PC and my laptop, one Windows task-bar and one XFCE4. Here's how I set it up:

  • First make sure WSL is set up.
  • Next install VcXsrv on the windows side, this will be used to display the graphical output from WSL.
  • Now we need to tell WSL to point to VcXsrv, to do this run: echo "export DISPLAY=:0.0" >> ~/.bashrc This file will be read on each start up of bash.
  • there is also an issue with dbus we need to sort out, to do this just run: sudo sed -i 's$<listen>.*</listen>$<listen>tcp:host=localhost,port=0</listen>$' /etc/dbus-1/session.conf in bash.
  • Lets test this works fully, fire up XLaunch (part of VcXsrv), choose "Multiple Windows", and put 0 as the display number. Click next twice then finish.
  • Run something graphical to test, try xeyes (you may need to install x11-apps first: sudo apt-get install x11-apps)
  • It worked? good, now we need to get a desktop running, I'll show the steps for XFCE4 however I have seen Unity working and I suspect LXDE should work. (I know that Cinnamon has multiple issues that seem to be similar to Gnome)
  • Run: sudo apt-get install xfce4
  • Once that's done run: xfce4-session, wait a minute and you should get a pop-up asking about panels, I'd recommend choosing the default config unless you are used to XFCE4.
  • If all this works we are nearly ready to go, feel free to position and configure your new task-bar now.
  • The next thing we need is a way to stop windows maximising underneath the new task-bar, for this I used Desktop Coral, its free but kind of annoying, you have to get a new key each six months, you get a lifetime key after a while though. If you don't want to use this then look for a program that can reserve screen space.
  • Once that is set up configure it so it reserves the same space as where your panel will live, and check that windows aren't drawing under it. When you are happy tick the transparent mode option
  • Now we need to make all this seamlessly "just work", Desktop Coral already runs on start up so that's covered. We now need a script on the windows side to get bash and XFCE4 running on start up. Fire up a text editor (notepad will do) and paste in this:

    set ws=wscript.createobject("wscript.shell")
    ws.run """C:\Program Files\VcXsrv\vcxsrv.exe"" :0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl",0
    WScript.Sleep 500
    ws.run "C:\Windows\System32\bash.exe -c 'export DISPLAY=:0.0; xfce4-session'",0
    
  • This starts our X Server and our desktop environment in one shot, save it as <somewhere important>/<whatever>.vbs.

  • Test this script works by quitting VcXsrv and then double clicking the script, wait a bit and your new task-bar should appear.
  • Now we need to make this run on start-up, so launch Task Scheduler, go to Action -> Create Basic Task...
  • Give your task a name, click Next then choose "When I Log On". Click Next twice, then type in or browse to your script. Click Next and finally Finish.
  • Last thing is to reboot to see if it works!

This should give you a mostly functional Linux environment within Windows, it's not prefect (might want to turn of the screensaver for one) but it does work! I haven't yet found out how to replace Explorer, I suspect this won't be possible as any programs you run from your new task-bar will appear on the Windows task-bar not the XFCE4 one.

As an aside don't be put off by XFCE4's bad looks, it is fully themeable and comes with tons of built in themes to choose from plus plenty more to download.

One final note is that this task-bar will draw on top of full screen windows, I currently use TurboTop to tun this off when I need it, not particularly elegant so keep an eye on this question for a solution.

Solution 2

By the way, all you need to do is:

apt update && apt upgrade -y && apt install xfce4 x11-apps lightdm

then,

xfce4-session --display=0:0

Just make sure you are using xming or vcxsrv or something on windows

Share:
19,286

Related videos on Youtube

Honk
Author by

Honk

_ __(.)&lt; HONK! \___)

Updated on September 18, 2022

Comments

  • Honk
    Honk over 1 year

    Is it possible to replace explorer.exe with Gnome3 on Windows10's Linux Subsystem? I've seen tutorials with Cgywin, but I was wondering if some one has gotten it to use WSL?

    I ran into problems with

    DISPLAY=localhost:0
    
    • AFH
      AFH over 7 years
      It's an intriguing idea, so I followed these instructions, and I have been able to run a number of GUI applications (including nautilus) using xming, but I haven't so far managed to get the Gnome / Nautilus desktop going. I suggest you try the Nautilus file manager to see if you like it before trying to go further. It's a bit like Wine under Linux: a lot of things work surprisingly well, but it doesn't feel 100% reliable.
    • Honk
      Honk over 7 years
      I'm a huge fan of Gnome3 + linux. I use it on my laptop daily I want a Desktop version but still running windows kernel due to software needs.
    • AFH
      AFH over 7 years
      I've used Ubuntu for years, but I started to go off it when they tried to foist Unity desktop on us, with attempts to restore Gnome classic only partly successful, but Ubuntu Mate has been a good solution and I'm now very happy with it. However, I've not been able to get either Mate or Gnome running under WLS, though Xfce4 works well, as per Owen Tourlamain's answer: it's not a bad desktop environment, and I quite like the way it integrates into Windows 10. I'll let you know if I get any further with Mate or Gnome.
    • AFH
      AFH over 7 years
      Further update: I've upgraded WSL to 16.04.1, to bring it into line with my other systems. Individual GUI applications still work, unlike any of the desktop environments: xfce4 runs, but the desktop is invisible, whether the X server is in single or multiple window mode. The upgrade was straightforward, although I needed these patches, with the additional library mirrors.kernel.org/ubuntu/pool/main/p/procps/… to get procps to install.
  • AFH
    AFH over 7 years
    The questioner is not using Cygwin, but WSL.
  • PrashantKumar96
    PrashantKumar96 over 7 years
    With WSL too, things won't be much different. C:\cygwin\bin\bash will be replaced by C:\windows\system32\bash . But the principle will be same- having a fullscreen x server running GNOME.
  • bertieb
    bertieb about 6 years
    That would install xfce4, not Gnome 3 which OP requested.