Slightly more uzbl

To make uzbl even more usable, I have added a download viewer script that is easy to configure and maintain. The purpose was to get uzbl to launch the appropriate viewer program when a file is downloaded from the net (like launching mplayer for a downloaded movie or zathura for viewing a downloaded pdf file). Other browsers do this as default, but as there is hardly anything default about uzbl (that is the whole point, really), one is left with the task of finding or creating the best add-ons even for viewing downloaded files. No add-on that I could find did the trick, and so I made one.


It wasn’t easy to figure out exactly how to hook a script into uzbl that fires upon a completed download. But with some pointers from people at the uzbl IRC channel, it was very easy to make it work.

Here’s what you do on a Linux system.

Add to your uzbl config file:

@on_event DOWNLOAD_COMPLETE spawn @scripts_dir/ %s

Then create the script “” and place it in the scripts folder (on my system, that would be “/usr/share/uzbl/examples/data/scripts/”). Do a “chmod 755” on the file to make it executable. The script would contain something like this:

case "$1" in
*.pdf*) zathura "$1" & ;;
*.jpg*|*.png*|*.jpeg*) feh "$1" & ;;
*.txt*|*README*|*.pl*|*.sh*|*.py*|*.hs*|*.hl*) urxvt -e vim "$1" & ;;
*.mov*|*.avi*|*.mpeg*|*.mpg*|*.flv*|*.wmv*|*.mp4*) mplayer "$1" & ;;

Edit to accommodate for your choice of viewers and file types to view.

Additionally, to set the “download directory” for uzbl, edit the file “/usr/share/uzbl/examples/data/scripts/util/” and change the line starting with “UZBL_DOWNLOAD_DIR=” to what you like.

hth 🙂

8 thoughts on “Slightly more uzbl

Have your say

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s