Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have most of my home directory dot files shared across my home and work systems, each running a different version of Ubuntu.

I'm looking for a way to specify the default image viewer for each system in ~/.mailcap, so when it's invoked by mutt, the correct image viewer will start.

My current work-around is to put the following in ~/.mailcap ...

image/*; viewimage %s; test=test -n "$DISPLAY";

... where viewimage is a simple bash script:

#!/bin/bash
hostname=`hostname`

if [ $hostname == 'work-host' ]; then
    imageviewer=geeqie
elif [ $hostname == 'home-host' ]; then
    imageviewer=ristretto
fi

$imageviewer $1

Any suggestions to avoid this workaround are appreciated.

share|improve this question
    
the problem with xdg-open is that it launches the relevant application and exit immediately. When xdg-open will exit, the mail reader will then consider that the job is done and remove the attachement that was stored for viewing (most of the time in /tmp) and that before the real viewer was launched. The viewer will then say that it can't find the file to be viewed. –  user166931 Jun 13 '13 at 15:02

1 Answer 1

Your solution is nice and lets you keep all the dotfiles on version control, so why change it? :-)

If you run either of the major desktop environments, invoke xdg-open instead? Is is the equivalent of double clicking a file in the file browser.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.