Search This Blog

Thursday, April 24, 2014

Make magnet links work in Xubuntu

When trying to open magnet links in Xubuntu, sometimes you will get an error.  For example, when searching in Catfish and a folder is clicked, I got this:
"Unable to detect the URI-scheme of /home/user/folder/folder".

You might also get this in Chrome when trying to open a magnet to a torrent file.  For some reason, Firefox works fine with magnet links (probably uses gnome-open instead of the system's opener by default).

To fix the problem, edit /usr/bin/xdg-open: sudo gedit /usr/bin/xdg-open

In there, find the lines that look like this:

if [ x"$DE" = x"" ]; then
And change it to this:
if [ x"$DE" = x"" ]; then
#xdg-open workaround for bug #1173727:
This will force Xubuntu to think you are using the Gnome Desktop Environment, and will in turn use gnome-open instead of xdg-open.  When Xubuntu detects the XFCE display manager, it calls exo-open "$1" which is not capable of handling magnets.  This workaround will get you going until the bug has been fixed.

Monday, April 21, 2014

Replace Ubuntu One with Insync

Ubuntu announced the pending shutdown of their Ubuntu One services recently.  I depend on Ubuntu One to sync my ~/Documents folder between my desktop and laptop, and have even bragged to Windows users how easy it is to get files from one computer to the next using Ubuntu One.  It seems that Canonical does not make enough money through their services, would rather focus on other projects, and so are shutting it down completely on June 1st.  This led me to finding an alternative solution.

Google Drive allows one to upload up to 15 GB of data to the cloud for free (100 GB is only $2/month).  There are many services out there that do the same sort of thing, such as Dropbox or Amazon Cloud Drive, and a quick search will reveal other cloud storage solutions.  The major downfall to using something other than Google Drive is that the common amount of free space given for storage is somewhere between 2 to 5 GB, with steep prices if you wish to expand.  I am an avid Android user, so I already make use of my pictures getting automatically pushed to Drive, as well as awesome Gmail integration.  So for me, the decision was simple: find a way to sync my two computers using Drive.

Introducing InSync.  At the most basic level, it allows a user to automatically sync data between a specified folder on their computer (/home/user/Insync, or whatever you desire to name it) and Drive.  This is useful, but other services offer the same thing (Grive, SyncDrive, etc).  But where InSync prevails is all the other stuff it is capable of:

  • Automatic conversion of Google Docs to Office (LibreOffice/OpenOffice compatible)
  • Built-in sharing without a browser
  • Recent changes feed
  • Window manager integration (ie Nautilus) - right-click a file to sync
  • Symlink, junction and alias support (key feature; more on this below)
  • Multiple Google account support
  • Watch any folder for changes
  • Support for almost every platform
  • And many others
As you can see by their features, InSync has done a great job at integrating Google Drive into the desktop environment.  Back to my original issue, however, is that I needed to sync two computers to be mirror images of each other.  This process is not glaringly simple in InSync, so this is how you do it:

  1. Ensure all your files are synced between the two machines using Ubuntu One or other methods
  2. Download InSync on one of the computers (we'll say desktop, for ease of explanation).
  3. Complete the installation, choosing the "Advanced Setup" when prompted
  4. Authenticate InSync with your Google account and choose where to store your files (/home/user/Insync).
  5. Once InSync has finished installing, Nautilus users (Ubuntu) may want to install package insync-nautilus in order to have right-click menu integration.
    1. sudo apt-get install insync-nautilus
    2. Restart Nautilus by clicking the prompt once that completes, or by logging out and back in.
    3. Another method is by opening terminal (Alt F2) and typing nautilus -q. This will kill the window manager.  You start it back by opening a folder either from Ubuntu's side bar, or pressing the Super key and typing home, and opening the folder.
  6. Now the fun part: create a symlink inside your InSync folder to your Documents folder:
    1. Right-click Documents in your home folder > Add to Insync > Your Google Account
    2. OR: ln -s ~/Documents ~/Insync/Documents
  7. This will sync all of your Documents to Google Drive.  Give it some time to finish.  Once the InSync icon in the toolbar looks like: 
    you are ready to proceed.
  8. On your other computer (laptop), prepare it for syncing by installing InSync, and choosing Advanced Setup again.  Do not put anything in the InSync folder, as your desktop and laptop are currently mirror images of each other via Ubuntu One.
    1. Don't forget to install the Nautilus integration and restart Nautilus (step 5)
    2. Go to InSync > Your Google Account Name > Settings > "Selectively sync your files & folders"
    3. Choose the Documents folder from your Google Drive, and Apply Changes
    4. Allow all of your Drive's documents to sync to your laptop
  9. On the laptop, rename ~/Documents to ~/Docs
    1. mv ~/Documents ~/Docs
  10. In the terminal on your laptop:
    1. ln -s ~/Insync/Documents ~/Documents
    2. This creates a symlink from Insync's Documents directory to a non-existing ~/Documents on your Laptop. (note** non-existing because you have renamed the ~/Documents folder on step 9)
    3. Note that this symlink is opposite of step 6.2, because we want to create the illusion of a ~/Documents folder that is actually under ~/Insync/Documents, allowing all previous shortcuts to continue working.
That's it! Your files on your laptop and desktop will stay in sync with each other.  

Now go disconnect Ubuntu One!