Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Open With Dangerzone" with 2 PDFs results in 2 instances of Dangerzone being opened on Linux #797

Closed
naglis opened this issue May 3, 2024 · 0 comments · Fixed by #798
Closed

Comments

@naglis
Copy link
Contributor

naglis commented May 3, 2024

Tested on Arch Linux/Dangerzone 0.6.0 (installed as package)/Gnome Shell 46.1/Nautilus 46.1. IIUC this only applies to Linux systems.

To reproduce:

mkdir /tmp/test_two_files
touch /tmp/test_two_files/{a,b}.pdf
nautilus /tmp/test_two_files
  • Ctrl + A to select all files
    • right-click with the mouse, select "Open With...", in the dialog select "Dangerzone"
    • or (if Dangerzone is the default application to open PDF) - hit Enter.
Screencast.from.2024-05-03.08-14-28.webm

Since Dangerzone supports converting multiple files at once, this is not ideal, as the conversion of each file has to be started separately in its Dangerzone instance. Also, if many files are opened this way, this can be overwhelming.


I believe this is because in its .desktop entry, Dangerzone uses the %u field code to signify what arguments it accepts. From the description for %u field code on the desktop entry spec:

A single URL. Local files may either be passed as file: URLs or as file path.

The description of %f (equivalent of %u but for local paths) sheds more light on this:

A single file name (including the path), even if multiple files are selected. The system reading the desktop entry should recognize that the program in question cannot handle multiple file arguments, and it should should probably spawn and execute multiple copies of a program for each selected file if the program is not able to handle additional file arguments.

So, to signify that Dangerzone can open several files at once, %U or %F field code should be used. I believe that Dangerzone should use %F, since %U is for both local files and URLs and Dangerzone does not support URLs (this can be tested by running dangerzone 'file:///tmp/test_two_files/a.pdf' which results in "Input file not found: make sure you typed it correctly." error).

Using %F in the .desktop entry results in a single Dangerzone instance being launched with both files selected:

Screencast.from.2024-05-03.08-15-09.webm
naglis added a commit to naglis/dangerzone that referenced this issue May 3, 2024
On Linux, the `%u` field code results in multiple Dangerzone instances
being launched when opening multiple documents with Dangerzone from
e.g. Nautilus, as `%u` signifies that the application (in this case -
Dangerzone) can only open a single file/URL at once.

This changes the field code to `%F` as Dangerzone (now) supports
converting multiple files at once. We use `%F` (multiple local files)
instead of `%U` (multiple files and/or URLs) since Dangerzone does not
support opening URLs.

See also the Desktop Entry Specification [1] for more information on the
field codes.

Fixes freedomofpress#797

[1]: https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html
@apyrgio apyrgio closed this as completed in c3a570e May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant