Starting native applications

Another example of using an intermediary script for an application with a command line syntax which can’t be directly defined in mimeview.

We use a script to preprocess and adapt the options before calling the actual command.

Details about configuring how the native application or script are called are given with the description of the mimeview configuration file.

qpdfview (web site) is a very lightweight tabbed PDF viewer with great search performance and result highlighting.

It does support parsing the search term and page number from the command line with the following syntax:

qpdfview --unique "%f"#%p --search "%s"

However, qpdfview will not launch if either %p or %s are empty in the command above. To accommodate for that, Recoll user Florian has written a small wrapper shell script:

#!/bin/bash

qpdfviewpath=qpdfview

if [ -z $2 ]
then
    page=""

else
    page="#"$2""
fi

if [ -z $3 ]
then
    search=""

else
    search="--search "$3""
fi

$qpdfviewpath --unique "$1"$page $search >&0 2>&0 &

The corresponding handler line for Recoll would be (depending on how you name the script and where you store it):

      qpdfviewwrapper %f %p %s