Download this file

UsingOpenWith.txt    69 lines (51 with data), 2.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
== Using the _Open With_ context menu in recoll 1.20 and newer
Recoll versions and newer have an _Open With_ entry in the result list
context menu (the thing which pops up on a right click).
This allows choosing the application used to edit the document, instead of
using the default one.
The list of applications is built from the desktop files found inside
'/usr/share/applications'. For each application on the system, these
files lists the mime types that the application can process.
If the application which you would want listed does not appear, the most
probable cause is that it has no desktop file, which could happen due to a
number of reasons.
This can be fixed very easily: just add a +.desktop+ file to
'/usr/share/applications', starting from an existing one as a template.
As an example, based on an original idea from Recoll user +florianbw+,
the following describes setting up a script for editing a PDF document
title found in the recoll result list.
The script uses the *zenity* shell script dialog box tool to let you
enter the new title, and then executes *exiftool* to actually change
the document.
----
#!/bin/sh
PDF=$1
TITLE=`exiftool -Title -s3 "$PDF"`
RES=`zenity --entry \
--title="Change PDF Title" \
--text="Enter the Title:" \
--entry-text "$TITLE"`
if [ "$RES" != "" ]; then
echo -n "Changing title to $RES ... " && \
exiftool -Title="$RES" "$PDF" && \
recollindex -i "$PDF" && echo "Done!"
else
echo "No title entered"
fi
----
Name it, for example, 'pdf-edit-title.sh', and make it executable
(`chmod a+x pdf-edit-title.sh`).
Then create a file named 'pdf-edit-title.desktop' inside
'/usr/share/applications'. The file name does not need to be the same as the
script's, this is just to make things clearer:
----
[Desktop Entry]
Name=PDF Title Editor
Comment=Small script based on exiftool used to edit a pdf document title
Exec=/home/dockes/bin/pdf-edit-title.sh %F
Type=Application
MimeType=application/pdf;
----
You're done ! Restart Recoll, perform a search and right-click on a PDF
result: you should see an entry named _PDF Title Editor_ in the _Open
With_ list. Click on it, and you will be able to edit the title.