Pages

18 August 2008

Use ROX-Filer to open containing folders in Firefox/Iceweasel

Update: See this for an easier way to accomplish the same goal.

One of the slightly bothersome things about using ROX-Filer with Iceweasel in Debian Etch (and I suspect Firefox in other distributions) is that Iceweasel won't "open containing folders" with ROX-Filer from Iceweasel's Downloads window. I was therefore pretty jazzed when I found this link at Rubylution that shows you how to tell Firefox (and Iceweasel) to use a specific file manager to open folders.

Of course I tried it, and of course it failed. The problem is that Firefox/Iceweasel sends the specified file manager the name of the directory in the form of a file://<filename> URL, and ROX-Filer doesn't get file URLs.* So, I wrote a script that uses sed to decode the URL to a form that ROX-Filer understands and then calls ROX-Filer with the decoded path.

So here's what you do:

Create an executable /usr/local/bin/rox-open-url:
#!/bin/bash

# Opens input argument in rox, where input argument is assumed to be a URL
# of the form file://<path-to-file>

# Mithat Konar 17 Aug 2008

# Requires sed and /usr/local/share/rox-open-url/urldecode.sed

##############################################################

# strip away file:// prefix and decode remaining characters
thePath=`echo "$1" | sed 's/^[fF][iI][lL][eE]:\/\///' | sed -f /usr/local/share/rox-open-url/urldecode.sed`

rox "$thePath"

Remember to make it executable.

Now create the file that sed will use to convert encoded characters in /usr/local/share/rox-open-url/urldecode.sed:
s/%08/\\b/g
s/%09/\\t/g
s/%0[aA]/\\n/g
s/%0[dD]/\\r/g
s/%20/\ /g
s/%21/\!/g
s/%22/\"/g
s/%23/\#/g
s/%24/\$/g
s/%25/\%/g
s/%26/\&/g
s/%27/\'/g
s/%28/\(/g
s/%29/\)/g
s/%2[aA]/\*/g
s/%2[bB]/\+/g
s/%2[cC]/\,/g
s/%2[dD]/\-/g
s/%2[eE]/\./g
s/%2[fF]/\//g
s/%30/0/g
s/%31/1/g
s/%32/2/g
s/%33/3/g
s/%34/4/g
s/%35/5/g
s/%36/6/g
s/%37/7/g
s/%38/8/g
s/%39/9/g
s/%3[aA]/\:/g
s/%3[bB]/\;/g
s/%3[cC]/\</g
s/%3[dD]/\=/g
s/%3[eE]/\>/g
s/%3[fF]/\?/g
s/%40/\@/g
s/%41/A/g
s/%42/B/g
s/%43/C/g
s/%44/D/g
s/%45/E/g
s/%46/F/g
s/%47/G/g
s/%48/H/g
s/%49/I/g
s/%4[aA]/J/g
s/%4[bB]/K/g
s/%4[cC]/L/g
s/%4[dD]/M/g
s/%4[eE]/N/g
s/%4[fF]/O/g
s/%50/P/g
s/%51/Q/g
s/%52/R/g
s/%53/S/g
s/%54/T/g
s/%55/U/g
s/%56/V/g
s/%57/W/g
s/%58/X/g
s/%59/Y/g
s/%5[aA]/Z/g
s/%5[bB]/\[/g
s/%5[cC]/\\/g
s/%5[dD]/\]/g
s/%5[eE]/\^/g
s/%5[fF]/\_/g
s/%60/\`/g
s/%61/a/g
s/%62/b/g
s/%63/c/g
s/%64/d/g
s/%65/e/g
s/%66/f/g
s/%67/g/g
s/%68/h/g
s/%69/i/g
s/%6[aA]/j/g
s/%6[bB]/k/g
s/%6[cC]/l/g
s/%6[dD]/m/g
s/%6[eE]/n/g
s/%6[fF]/o/g
s/%70/p/g
s/%71/q/g
s/%72/r/g
s/%73/s/g
s/%74/t/g
s/%75/u/g
s/%76/v/g
s/%77/w/g
s/%78/x/g
s/%79/y/g
s/%7[aA]/\z/g
s/%7[bB]/\{/g
s/%7[cC]/\|/g
s/%7[dD]/\}/g
s/%7[eE]/\~/g

Once you've done this, you can use the method described at Rubylution to set rox-open-url as the command to use to open containing folders.

Caveats: The script and sed file should be considered beta. I have done my best to make sure that the files render properly in HTML, but conversion gremlins may exist. If you find any problems, please let me know.

Reinventing the wheel? Probably. I'm pretty sure someone else has already done something very similar to this, or there may be an easier way to do the same thing. But in the two minutes I spent trying, I wasn't able to find anything.

*This is true at least in Firefox 2 and the version of ROX-Filer that's part of Debian Etch. I don't know what Firefox 3 does nor if the latest release of ROX-Filer handles file URLs.

17 August 2008

Tweaking the Debbie

I've made a few tweaks to SkinnyDebbie, some to fix bugs, some to make some behavioral improvements. In particular, I have:
  • Added /usr/local/bin/rox-open-url and /usr/local/share/rox-open-url/urldecode.sed
  • Added config-iceweasel-defaults.sh to install process that modifies Iceweasel default preferences (/etc/iceweasel/profile/prefs.js) to download files to home directory (with prompt) and use rox-open-url to "open containing folders".
  • Changed ownership of /etc/X11/xdm/Xsetup to root
  • Changed tooltip and properties text for "Screen resolutions" control panel.
The official changelog is here.

If you are an early SkinnyDebbie adopter and want to implement these changes, let me know and I'll send you a custom updater script.

06 August 2008

SkinnyDebbie is done



The initial release of SkinnyDebbie is done. What started as something that I thought I could put together in a few evenings has turned out taking far, far longer than that. But I think the results have been worth it. There are aspects of the user experience that still need cleaning up, but overall I think it's a pretty decent lightweight desktop.

Most of my time was spent writing scripts to make system administration easier for less-than-sys-admin types. Automounting in particular was a royal time hog. If you are insane enough to actually read all the custom scripts (both the ones that do the installation as well as the ones that are installed as part of SkinnyDebbie), you will be able to track the development of my Linux competence.

I've decided to give SkinnyDebbie its own website. For the time being, it will be hosted at http://birotechnology.com/skinny. I am hoping this is a temporary situation and that a more suitable location will present itself. I'm also hoping to flesh out the installation instrutions a bit more once I have recovered a bit from the last few days of development and testing.

Now, please go forth and install. And then let me know what you think.

05 August 2008

automounting - part 2

Here is a brief (!) summary of the problems I encountered in setting up automounting in SkinnyDebbie and what I did to get it to behave. The whole process relies on hal and ivman. Maybe there is a better way to do this; if so I would love to learn how.

In no particular order ...

If media is present when user starts machine, the media automounts under ivman's account, and then a regular user can't unmount it.

Solution:
  • Disable ivman daemon so that the ivman user doesn't do any mounting:
    # update-rc.d -f ivman remove
  • Start ivman under the user's account at login so the regular user can mount via ivman.
In other words, have ivman run as user and do not have it run as ivman (which is what the daemon makes happen). The major consequence of this approach is that it will only work if one user at a time is logged into the machine or only one user at a time is authorized to use automounting.

Turning off the ivman daemon is handled by the SkinnyDebbie installer. I wrote a custom script (start-ivman) to handle user startup that checks the above at IceWM startup. I also wrote a control panel widget that repairs the above if it breaks (e.g., after an ivman package update).

The default SkinnyDebbie behavior is that automounting will be started for the first user that is logged in and not for subseqent users until the first user logs off. In practice this is fine because SkinnyDebbie is intended for single-user logins. The start-ivman script warns the user if someone else is already using automounting.

Not all media automounts, USB hard drives in particular

Solution:
These are done automatically by the SkinnyDebbie installer, except for removing CDROM and DVD links from /. The repair control panel applet also removes directories in /media that do not appear in /etc/fstab.

It's not at all obvious to the regular user where/when removable media is inserted

Solution:
  • Edit ~/.ivman/IvmConfigActions.xml so that:
    ROX-Filer announces the insertion of media and prompts the user for desired action (e.g., open /media directory, launch CD ripper, etc.)
    ivman scans on init
  • Add /media link to the desktop
  • Add /media link to Rox's bookmarks
  • Add /media link to IceWM's "start" menu
SkinnyDebbie's ~/.ivman/IvmConfigActions.xml is configured to handle CD-ROM, CD-Audio, DVD-video, and USB-based storage devices. At the present time I don't know what it will do with other removable media ( e.g., Compact Flash). It will also scan on init.

There are several custom "annc" scripts (anncRoxMedia, anncCDDA, anncDVDvideo) that get called per media type. These scripts check to see if ROX's pinboard is running; if it is, then it will announce the insertion of media. The IceWM startup delays the start of ROX's pinboard by a few seconds so that the user doesn't get bombarded with media announcements when logging in.

If user logs off without unmounting stuff, the folders remain in /media but the media is not mounted

Solution:
  • Write script pumountall that pumounts everthing and use it to unmount everything at logoff (via ~/.icewm/shutdown).

User needs guidance in good habits (i.e., unmount before remove)
Solution:
  • Write script pumount-fb, which does pumount with GUI feedback.
  • Tell ROX-Filer to use script pumount-fb to unmount.

CD and DVD media don't mount ... ever
See "Not all media automounts, USB hard drives in particular" above.