June 15, 2009

Mounting Samba shares from Firefox

Ever since I dumped Gnome for pure WMs and heavy file managers for their lighter counterparts, my only problem was with samba shares. I used to mount them with Nautilus, Gnome's native file manager, but unfortunately, this doesn't work with Thunar or PCManFM.

A bit of googling reveals that many people asked the question:

How can I mount samba shares in thunar?
The solution usually boils down to one of these things:
None of these solutions really satisfied my requirements -- I went with manual mounting for a while, but that is a tedious task, mounting the whole network or running specializes application just seems impractical. Furthermore, I wanted to be able to mount shares just by clicking on smb:// links in firefox.

In the end, I wrote my own solution. See it in action.



It is a simple bash scripts which takes the URL and mounts all available shares. The current version of the smbmounter script can be found on github.

Download the script and place it somewhere. Then edit it and change the variable FM to your preferred file manager (default is thunar) and variable MOUNT_ROOT to the root directory where all shares shall be placed (default is /media/samba).

mount.cifs needs to run as root, so to be able to let the script run unattended (which is important if you want to use it from firefox) you need to set passwordless permission for either mount.cifs or this script. This can be done in /etc/sudoers. This is an example which will allow this for all members of group wheel.

%wheel        ALL=NOPASSWD: /sbin/mount.cifs

For an extra paranoia, modify the script to use gksudo instead of sudo.

Setting it as a protocol handler in firefox is a bit tricky. Following steps apply for Firefox 3.0.*, Firefox 2 configuration is slightly different and I never managed to set it in Firefox 3.5b4 (but hey, it's beta).

Open about:config and create new boolean property

network.protocol-handler.external.smb = true

and new string property

network.protocol-handler.app.smb

Leave this one empty -- for now. Now click the smb:// link, the format should be smb://hostname_or_ip/ The dialog will appear, asking for external application to launch. Select this script and check remember. Now go and mount.


January 19, 2009

Enigma ported to Linux

Inspired by the wonderful Enigma desktop by Kaelri, featured at Lifehacker, I decided to port at least some of the beautiful design to my Linux desktop.

The result is this:

Compared to the original theme:

My desktop features

  • Simple calendar — I even considered adding google calendar events using gcalcli, but the desktop was way too crowded
  • RSS news
  • Remember The Milk tasks
  • Weather Forecast
  • and system stats

Almost everything you see is drawn on desktop using conky. There are however, few major drawbacks:

  • With conky you get either full transparency, or no transparency at all. It's all or nothing
  • Conky cannot draw pictures.

So how did I get the transparent sidebars and icons? Gotcha! They are part of the desktop background.

I also decided to omit the analog clock — this is certainly doable with gdesklets or screenlets, but I almost fainted when I saw the dependencies. My desktop stays lightweight, no matter what. I tried the lightweight adesklets but the result was disappointing.

To recreate this desktop you need:

  • "Patched" background — I provide a GIMP layered image, you just need to replace the background layer for the image of your choice
  • Conky and conky configuration files
  • Weather fonts — fonts displaying weather conditions (included)
  • RTM command line tool for the RTM task list
  • I am using tint2 as the panel, but any transparent panel (such as gnome-panel) should do

Installing the RTM command line tool might be tricky, as the author notes, you need to install RTMAgent perl module first:

This package is split in two components:
  • RTMAgent.pm: a Perl module that implements the low-level API. It provides a UserAgent object which lets you call all of RTM's API methods as normal Perl methods. You will need to install it from CPAN: cpan install WebService::RTMAgent
  • rtm: a Perl script that uses RTMAgent to implement a command line interface. Just put it in your path.

It seems that there are two flavors of the cpan installation scripts, mine required the following syntax: cpan -fi WebService::RTMAgent, where -fi stands for force install, as one of the dependencies failed its unit tests. Your cpan scripts syntax might vary, check the corresponding manual first.

After installing the RTMAgent, run rtm --authorise, follow the generated link and allow RTM API access. This should be done only once, before the first run.

Don't forget to change your username and password in scripts/gmail.py and set your location code in scripts/conkyForecast.template. See the instruction for the weather forecast config.

That should be all. Both wallpaper and conky configs are designed for 1280x800 resolution, you'll probably have to move things a bit for different resolutions. Unpack the attached archive to ~ (archive contains hidden files, you have been warned), set the background, set up rtm, gmail and weather forecast and run ~/scripts/start_conky.

DOWNLOAD the background and scripts.

Credits:

I am aware, that the desktop still has some rough edges, but I am posting this in the spirit of

Release early, release often.