I want to mount/unmount my google drive using
google-drive-ocamlfusewith a key binding without having to open a terminal. How can I set this up?
/bin/bash -c "google-drive-ocamlfuse ~/path/to/foldershowinggoogledrive"
path/to/foldershowinggoogledrive is the path relative to your homedir.
No need for sudo!
Similarly, to unmount, if you use
~, you should use in a shortcut:
/bin/bash -c "fusermount -u ~/relative/mountpount"
Or if you use absolute path:
fusermount -u /absolute/path/to/mountpoint
Why /bin/bash -c?
You could use
but since you are using
~, you need the expansion handled by bash.
Binding commands has been explained within How to bind custom commands to keyboard shortcuts?: System Settings -> Keyboard -> Custom Shortcuts -> + button
Just noticed ODrive which works substantially different. ODrive actually downloads the files and synchronizes with Google Drive, similar to how the Windows version of Google Drive works.
The big advantage -at least to my experience- is the immediate response to editing & saving, while the previously mentioned solutions have a huge delay on the work process during saving.
Gnome online accounts can do this for you. It may be already installed but if not you can find it in the software center or download it for your Ubuntu version and architecture here. Now you can connect your google account to gnome through Settings->Online Accounts. If Online Accounts isn't present in the list log out and back in again.
Choose Google from the list of Online Accounts and sign in with your credentials.
Gnome will request permissions to Access which you'll have to accept. If you are asked for your keyring password (usually your login password) provide it.
Click on the Google Account.
Flip the files switch on and then close the Window.
Open Nautilus and you should see a networked drive option that matches your google account on the left pane. Click on that and enjoy access to your google drive!