Every so often, I solve a problem with a hammer

January 23, 2012

For reasons beyond the scope of this entry, I maintain a special Firefox profile and instance for uploading pictures to my Flickr account. Back in the old days, Firefox had a very convenient behavior for this: when it asked you to choose files to upload in an upload form, the default directory was the current directory that you'd started Firefox in. This meant that I could cd to the day's photo directory, start my Flickr Firefox instance, and have the GTK file chooser dialog start in exactly the right directory. Then at some point Firefox changed this so that the default file chooser directory was something like your configured download directory.

I poked at this off and on but couldn't find a way to make Firefox get its old behavior back. So recently I decided to fix the problem with brute force. The script that I use to start my Flickr Firefox instance now looks somewhat like this:

#!/bin/sh
ln -nsf $(pwd) $HOME/CURDIR
exec firefox -P flickr "$@"

This is inelegant and not a real solution, but it makes things a lot more convenient; it's now much faster to navigate to exactly where I want to be. Sometimes that's the right way to deal with a problem, when either the real solution is too much work or the problem is too small to justify anything more than a quick hack.

(I suppose that this could be slightly improved by putting the symlink directly in the download subdirectory. I'm not sure why I didn't do that.)


Comments on this page:

From 89.12.85.45 at 2012-01-23 16:27:37:

Any idea if it is somehow possible to replace the GTK File Chooser with something completely custom? I'd much prefer a popup xterm with my shell and the addition of a command for picking files.

By cks at 2012-01-23 20:10:12:

I don't know for sure, but I very much suspect that it's not possible to replace the file chooser. I expect it's hard-coded in the GTK libraries as a widget.

From 166.250.77.61 at 2012-01-25 03:58:59:

KGtk can replace GTK file pickers w/ a KDE one. Likewise you could replace the GTK file picker with any other you choose too with a bit of hacking on it.

http://kde-apps.org/content/show.php?content=36077

Samat

Written on 23 January 2012.
« My view of the purpose of object orientation
Why I use exec in my shell scripts »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Mon Jan 23 00:15:48 2012
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.