Integrating Google Drive with Ubuntu

A couple of months ago I switched from Windows to Ubuntu and I do not regret it for a second. There is however something that I was missing. A Google Drive client.

Sure, Google Drive has a very good web interface but sometimes you just want to add a document to Drive without opening the website. On Windows I could just drop it into a folder and the Drive client would sync it to the Google servers. Of course I went to the Drive website and I tried to find a downloadable client for Ubuntu, but I got greeted with this screen:

Drive not ready

Running Linux? Stay tuned - Drive for Linux isn't ready just yet.

U wot m8? Seriously? I did some research and that message has been there for at least 3 years. I am not sure how long Google wants me to "stay tuned" but I am not staying tuned for 3 bloody years.

Surely there has to be a proper way to add Drive to my Ubuntu filesystem. Yes. There are. There are a few paid options out there but I am looking for something open source. And I found it. It is called "google-drive-ocamlfuse"

This wonderful piece of software mounts Google Drive to your filesystem. And it has support for multiple accounts! So it is ever better than the Windows client. And it runs flawlessly on Ubuntu 16.04 Xenial Xerus.

You can follow the instructions on the "Installation" and "Usage" wiki pages to get it running.

I would however like to make a recommendation: set the "export" options for all the filetypes to "desktop". This transforms all your Google Docs shortcuts into links to the Drive website. Otherwise they will be read-only documents that open locally in, for example, LibreOffice. You can change this in the configuration file located in ~/.gdfuse/default/config - if you used a label, replace "default" in the path with the name of your label. For example, if you would like all documents to be links to the Drive website, the config entry would look like this: document_format=desktop The same logic goes for other Google Drive types like spreadsheets, slides, forms, etc.

By default those link-shortcuts will look like blank pieces of paper. Would it not be awesome if those shortcuts looked like their actual filetypes? That is also possible! You can point the config entry doctype_icon to the path of the icon you would like to use.

You can download the official icons from this page. I recommend that you extract the icons you would like to use to ~/.local/share/icons. After extracting the icons the folder should look something like this:
Drive icons

Now you can set the path in the config entry like this:

and for filetypes that do not have an icon I use the drive-logo.png, like this:

If you already had Drive mounted you must unmount and remount using the -cc option, that will clear the cache, for example: google-drive-ocamlfuse ~/drive/ -cc.

Now you are all set! If you would like to automaticly mount Drive take a look at this page.