dangerzone icon indicating copy to clipboard operation
dangerzone copied to clipboard

Detect default application for opening PDFs

Open apyrgio opened this issue 1 year ago • 2 comments

Dangerzone has some logic for detecting which application (*.desktop file) can open a PDF:

https://github.com/freedomofpress/dangerzone/blob/65776d8c0506535c20f74f4375193287e1e8a78b/dangerzone/gui/logic.py#L97-L123

The result on Tails 6.2 is the following application list:

image

However, what's missing here is to present to the user the default application for opening PDFs. Instead, the first choice is picked up at random. Here, it's GIMP, whereas it should be Document Viewer.

apyrgio avatar May 23 '24 10:05 apyrgio

On almost all Linux distros, we can use xdg-mime to find the default application for a mime type. On Tails, it returns the correct application:

$ xdg-mime query default application/pdf
org.gnome.Evince.desktop

We can improve this list by putting at the top the desktop file that xdg-mime returns. If xdg-mime is not present, or returns no results, we can keep the list order as is.

apyrgio avatar May 23 '24 10:05 apyrgio

Re-opening this issue, because we see that Dangerzone in Tails 7.0 RC1 manifests the same behavior.

apyrgio avatar Aug 04 '25 17:08 apyrgio

(Still present in Tails 7.2)

almet avatar Nov 20 '25 14:11 almet