This blog tutorial will address taking advantage of features available in X Windows on the Raspberry Pi.

 

What is X Windows

 

 

From Wikipedia:

The X Window System (X11, or shortened to simply X, and sometimes informally X-Windows) is a windowing system for bitmap displays, common on UNIX-like computer operating systems.

X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting with a mouse and keyboard. X does not mandate the user interface — this is handled by individual programs. As such, the visual styling of X-based environments varies greatly; different programs may present radically different interfaces.

X's design requires the clients and server to operate separately...

 

Modern X implementations use Unix domain sockets for efficient connections ...

 

Taking advantage of this design

 

OK. What does this mean to us. What we now know is that X Windows is the windowing system for UNIX/GNU Linux type operating systems. We know that the client and the server operate separately, and we know that it uses sockets for communication.

 

Taking advantage of the fact that the client and the server operate separately and communicate through sockets, we can run the client (the GUI program) on one machine and display the output on another machine running an X server.

 

On a linux system, this is a trivial task. I currently run Ubuntu on my desktop, and my Raspberry Pi is connected to my local network. Without any special configuration I can log in to my Pi via ssh, start a GUI program, and have it display on my local monitor. This avoids the necessity of having an additional keyboard and monitor setup just for the pi.

 

unix screenshot

 

You'll notice that in the terminal, I started out on my desktop, onyx, did

ssh -X pi@raspberrypi.home

 

Notice I typed the ssh command with the -X argument. This allows X11 information to be forwarded. There are security implications to this, but I leave the research of those up to the reader. For a home development network this is probably not an issue.

 

once logged in there, I simply typed

geany &

 

to start the geany program, and it displayed locally. The & means to run the program in the background, and to return control of the terminal to the user.

 

If you look at the title bar of the application, you can see that it says

 

Geany (on raspberrypi)

 

and I am able to open files on the raspberrypi in the geany editor, and display them locally. I can hit F9 to compile, and F5 to run, and the output displays on my screen, as if I were running locally.

This saves the step of editing locally and copying the files to the pi, or of logging into the pi and running a text based editor, such as vi or nano. All of the processing takes place on the pi. The compilation, the save, and the execution. Only the display is forwarded.

 

Realize this capability takes no (with the exception of the editor, geany, but any gui program will work)  additional software other than what comes with both a standard Ubuntu installation on my desktop, and raspian, as distributed, for the pi.

 

What about windows users?

 

Fortunately, you are in luck. There are packages available that will give you the same capability. One such program is MobaXterm, available at MobaXterm free Xserver and tabbed SSH client for Windows . There is a free Home Edition and paid for professional edition that each provide a terminal, an X Server, and other tools. This is one of several packages, but this is the one I have been using when I work from a windows system. I'm not going to cover setup and installation, it was a typical windows install. Once it is installed though, this is what you can expect:

 

windows screenshot

 

This is a capability I have taken advantage of for years that I get the feeling people new to the Raspberry Pi and linux world are not aware of. This is a great way to take advantage of your existing hardware without having to setup vnc or any other type of screen sharing system. It allows you to only display the applications that you are using integrated seamlessly into your current desktop.

 

Bear in mind, there are configurations, network setups, etc..., that can cause this not to work as easily as I have demonstrated above, I would urge you to search google for the answers for issues you encounter if you decide to attempt this. This technology is 20+ years old, and there is a wealth of information for it already on the net.

 

If you were aware of this prior to this post and have something to add, please leave a comment, if this is new to you, I hope it helps.

 

BTW, this is not limited to the Raspberry PI, this works on odroids, beagle bones, and pretty much any of the SBCs running a variant of linux, It also works the other way as well, if you have a ras pi with a monitor and keyboard connected, you can login to another pi or unix machine on your network and do the same thing.