NautilusSvn and New Emblems

After writing last week about how I missed the Windows-only Tortoise(CVS|SVN) in GNU/Linux and sharing my simple scripts for running Subversion commands from Nautilus, I found Nautilus Svn by Jason Field, an Extension written in Python. (And available under the GPL v2.) It’s very nice, and adds (among other things) a major feature that you want in a graphical source control tool integrated with your file manager: visual cues of file status via icons. It uses Nautilus’s Emblems:

Original CVS Emblems

Those are what I have by default with the “Human” theme in Ubuntu 7.04/Feisty Fawn. So what are emblems? I’ve previously noticed the house emblem on my home dir and the lock emblem on system directories (hard to miss them). There is also a tab in file properties dialogs for Emblems, and in Nautilus there is the Edit » Backgrounds and Emblems… menu. I had seen the hints, but so far I haven’t had cause to learn all what they are good for. Well, now I’ve seen one useful application firsthand. (I also found this page with interesting information: Navigating Nautilus.)

NautilusSvn was easy to install via a .deb file, and after logging in and out, the icons/emblems worked fine, showing the status properly and updating automatically as the status changed. The only thing I didn’t care for was the look of the emblems. In the tree and list views, they obscure almost the entire icon. They are also too uniform for my tastes. I like how TortoiseCVS uses different colors, helping you more quickly determine which files have been modified.

Here’s what I saw (also shows the popup menu with SVN commands):

Examples of CVS Emblems in a Directory

(Your mileage may vary with different GNOME installations.) The print.css file has been modified. In the list view on the right, the difference between modified and unmodified is noticeable, but doesn’t jump out at you. In the tree view they’re even harder to distinguish. In any case, I’d prefer something that doesn’t dominate the underlying icon so much.

I found a couple of different ways to get different, smaller emblems in there. First I figured out a hard way to do it and made my own icons, and then I found an easier way where someone else had already done the legwork. I’ll reverse that here and show you the easy way first.

Had I sooner followed the link from Jason’s “Freebies” page to this discussion page, I would have saved myself some trouble:

http://groups.google.com/group/nautilussvn/browse_thread/thread/d4a941c0636d2318

Bruce van der Kooij explains how you can use the TortoiseSVN icons, resulting in:

Examples of SVN Tortoise Emblems in a Nautilus Directory

Which I think looks much better. I’ve included the icons in a tgz file at the end of this post. Creating emblems via Edit » Backgrounds and Emblems… will cause a .png and .icon file to be created for each emblem in ~/.icons/hicolor/48x48/emblems/. You can take the TortoiseSVN emblem files and place them in there (creating the dir if necessary), and then modify the NautilusSvn.py script:

EMBLEMS = {
        pysvn.wc_status_kind.added : 'svnadded',
        pysvn.wc_status_kind.deleted: 'svnremoved',
        pysvn.wc_status_kind.modified: 'svnmodified',
        pysvn.wc_status_kind.conflicted: 'svnconflict',
        pysvn.wc_status_kind.normal: 'svncontrolled',
} 

Tortoise SVN Emblems on Icons

NautilusSvn.py will have a symlink in ~/.nautilus/python-extensions/ if you followed the manual installation instructions, or in /usr/lib/nautilus/extensions-1.0/python/ if you installed from the .deb file.

After modifying the script, you’ll need to restart Nautilus by logging out and back in, or running nautilus -q which will stop Nautilus (closing any open file manager windows), after which you can immediately start it again. Then you should see your new icons.

That was pretty easy, and I would have stopped there, but I had already done my own experiments and written about it, so you can read on for more if you find this all very fascinating…

Investigation

There are a few places to look at for emblems. In addition to the home dir, I found stuff in:

/usr/share/icons/Human/scalable/emblems/
/usr/share/icons/gnome/scalable/emblems/
/usr/share/icons/gnome/48x48/emblems/

But it was unclear what everything is for. There are .svg, .icon, and .png files. The icon files are text and the png files don’t look like the emblems at the top of this post. (Although the TortoiseSVN .png files do look as I expect.) The svg files were the only ones that looked right, and it was only in the Human scalable dir that the complete set of six emblems could be found. (I realized later that the “sticky” emblem doesn’t seem to be used.)

Following another strategy, from Nautilus Edit » Backgrounds and Emblems…, I tried to create an emblem out of an svg file, but was rebuffed. I then managed to create an emblem out of a png file, and found that the .png and .icon files were created in the home dir mentioned above, but at the time I didn’t know where to go from there.

None of this was bringing a lot of clarity. My tentative early searches in Google weren’t turning up a treasure trove of information on emblems. I focused on the svg files in the Human icons dir. These are Scalable Vector Graphics files, which I am minimally familiar with, but knew that Inkscape was the application to use with them. And, as I suspected, Inkscape is super. I love free software. With a look at the Basic Tutorial and a couple of searches, I was able to create these killer replacement svg emblems:

New CVS Emblems

Which after swapping in to /usr/share/icons/Human/scalable/emblems/ and logging in and out, produced this effect in Nautilus:

Examples of new CVS Emblems in a Directory

New CVS Emblems on Icons

  • Note 1: The files are actually named like so: emblem-cvs-added.svg.
  • Note 2: I don’t really think they’re all that killer of graphics, although I’m pleased with how they turned out. My graphic arts skills are rudimentary at best.
  • Note 3: I wish I would have used nautilus -q instead of logging in and out. It’s much easier.
  • Note 4: Not sure what the scaling is all about. The TortoiseSVN png/icon emblems scaled just as well as the svg emblems. At one point I saw something odd where the list view at 75% and 100% wasn’t showing my scaled emblems, but was showing the originals. Other zooms showed my icons scaled appropriately. Logging out and in took care of that. (As I’m sure would “nautilus -q”, again.)

The other way was really much easier and more elegant, but I figure it’s always good to poke around with this stuff, and my lost time can become your gain. Good luck!

Downloads

22 February 2008: Go to Jason’s site for the latest and greatest Nautilus Svn files, but acting as a backup site, here are the GPL v2 files I downloaded back in November:

References

9 thoughts on “NautilusSvn and New Emblems

  1. Excellent ! Indeed TortoiseSVN is an explorer extension that I miss on Linux. I found both the pointer to NautilusSVN and the way to change the icons very helpful. Thank you !

  2. fine article!
    exactly what i was looking for, you saved me some time that i’d have needed figuring that out myself.
    indeed NautilusSVN is a powerful tool and i am glad it is out there. i am using ubuntu 7.10 gutsy and it’s working like charm.

  3. Nice article, I made it work in Ubuntu 8.04, just followed the instructions in the compressed file (not the .deb).

  4. Thank you very much for all the Nautilus SVN related posts! I liked TortoiseSVN much on Win, now after moving to Linux I’m very glad to find this solution.

  5. Excellent post,
    I can now work happily with my ubuntu box, without having to whine about the “missing tortoise” :D
    Thank you very much!

Comments are closed.