Wednesday, May 31, 2017

First version of HostBridge is done

I'd like to tell you a story. There are no enchanted woods or castles, nor knights and dragons, but a very simple and clear request from many people on AROS-EXEC: "would you make a hosted version of Icaros Destkop?".

A hosted Icaros. Why not? After all, drivers development for native AROS is quite slow and many developers would find a hosted Icaros environment extremely comfortable to test their applications, so I started adding Linux, and also Windows hosted options to the distribution. But, you know, having Icaros running all alone in a window didn't satisfy me. I made Icaros to show that AROS is usable every day, but Windows users have Photoshop and millions of other image editors: why should they use LunaPaint or ZunePaint? Linux users have Inkscape and LibreOffice, why should they use ZuneFig, Cinnamon Writer or Ignition? Both have Firefox and Chrome... why should they browse the web with OWB? Let's get real: being AROS or Amiga fanatics wouldn't just be enough to use our programs instead of the "competitors" when the others are easier to use, do more or just work better in many cases.

"Never give up, Paolo!"

I thought a lot about that, and I understood that the question was wrong. What Icaros Desktop can do inside of Linux or Windows does not matter; on the contrary, what Linux and Windows may do outside of Icaros Desktop does! If I found a way to use host applications along with native ones - I thought - people would have been able to speed up their work and get the best of both worlds. The answer to this question is now part of Icaros Desktop 2.2 and it's called HostBridge! (Yes, in the end I chose that name, even if I didn't initially like it).

HostBridge allows to "integrate" host applications into Icaros Desktop, allowing people to invoke them straight from the AROS shell, from Wanderer, Magellan, AmiStart or any other AROS file manager or launcher dock. In the top left corner of this post I'm showing a couple of notes I wrote on paper before actually starting to code. There were many compelling missions that HostBridge had to achieve, but the result is really encouraging (keep in mind this is just the first release).

First of all, it must run on any Linux distribution and Windows. I initially asked Pascal Papara if he would let me use AEROS' lx command, but he sincerely answered to me that lx requires so many changes to the host system, that I would have ended up into making a complete Linux distro, exactly like he did. That's not the goal I had in mind: hosted Icaros must try to adapt to users' operating systems, not force users to change their habits. Moreover, lx couldn't run with hosted Windows, so I needed a completely different approach. I ended up making a very simple "icaros daemon" which runs on the host system, looking for a command to execute, and run it when AROS passes it. Plain, easy and, best of all, good for any host system.

Then, it must feel natural to use from the AROS side: when you tell a Linux or Windows program to open a file, it expects that your file is stored in a reachable folder of your host system. If you simply tell Photoshop to open an image stored in SYS:Temp/MyDiary, Windows would have to complain that the image path, that's so easy to understand for AROS, is completely meaningless to him. So paths must be converted, but user should not be bugged about this. Having the AROS user entering a command like "hbridge Photoshop.exe C:\IcarosDesktop\Temp\MyDiary\myphoto.png" was not an option to me. HostBridge converts 'alien' paths for you.

"hbscript home:make-live.sh"
Moreover, it must be cosy. The "command program" approach didn't satisfy me: it's good to run a program alone or a script just once. Why not simply entering the program name to make things easier? "Photoshop myphoto.png" should be enough if you are already in the same directory of your image. So yes, HostBridge remembers the names of your applications and uses them like shell commands, allowing you to enter also a file name to open. This happens because HostBridge, for every integrated application, creates a script for you which accepts parameters, and calls it with the same name of your Windows or Linux executable (without that ugly .exe extension!). You can obviously modify the name of this script as you like, once it has been created.

"Photoshop Pictures:deadddreamer_giftgas.jpg"
 There is an obvious limitation, though: if your file is stored on the RAM drive, or in a Janus-UAE hard drive, your host system has no way to reach it. But this unfortunate condition is handled as well, so HostBridge will warn you when it's not applicable. It also recognizes Internet paths starting with http: and ftp: once you have integrated Firefox, when you'll cast a command like firefox http://www.youtube.com it won't look for www.something files into the fictional volume 'http:'. But it will open that site with Firefox as expected.

"Firefox http://www.icarosdesktop.org"

HostBridge also allows to add an icon to your integrated apps. This is mandatory to let you run them from Wanderer, Magellan etc. But there is also a way to set a host application as default tool for a single file or for a whole kind of files. This can be done with Migario's wbXcli command and it will be well explained in Icaros Manual.

Translate