Open in default app on Linux renders Obsidian unusable

Steps to reproduce

Use a Linux-based operating system.

  1. Have a PDF file in the Vault
  2. Have Evince or Okular as a default PDF opening application
  3. In Obsidian, right click on the PDF and open it in the default app

This makes Obsidian stop responding until the external application has been closed.

I’ve managed to circumvent this by creating a new desktop shortcut for evince with the -w flag added and setting it as my default. This change detaches the children process and releases Obsidian when the default app is used to open the PDF.

Expected result

I expected to be able to use both, Obsidian and Okular/Evince.

Actual result

I could only use the PDF reader, Obsidian was stuck until I quit the PDF viewer.

Environment

  • Operating system: Arch Linux, i3wm
  • Obsidian version: v0.12.19

Additional information

strace for obsidian shows this syscall if it’s of any use:

141495 execve("/usr/bin/evince", ["/usr/bin/evince", “/home/nenad-home/Dropbox/SecondBrain/Software Engineering/Leadership/Books/book.pdf”], 0x564f598b93a0 /* 50 vars */) = 0 <0.000252>

this is a problem with how your Desktop environment handles opening files associated with other programs.

Has been asked other times. Search the forum for possible solutions.

I have Ubuntu 20.04.3 LTS, Evince 3.36.10 and Obsidian v0.12.19 and I can not reproduce the error. I can open several PDF files from within Obsidian and both the PDF viewers and Obsidian keep on working as expected.

I scoured the forum trying all kind of combination of keywords: linux, block, freeze, default app, and I found out this one which is the closest: Opening in default app now results in Obsidian blocking until I close the default app

However, this doesn’t seem to be solved in the forum. The other poster in the link I shared claims that this behavior worked before, so maybe the problem was introduced in a newer version of Obsidian.

I’ve managed to solve it with a “hack”. I’ve created a dummy .desktop file that points to this wrapper script which runs the PDF viewer and detaches the process.

Dummy desktop file in ~/.local/share/applications:

[Desktop Entry]
Version=1.0
Type=Application
Name=ZathuraWrapper
Exec=/usr/bin/zathura-wrapper %U
Icon=org.pwmt.zathura
Terminal=false

and the zathura-wrapper script:

#!/bin/sh

zathura "$1" & disown
1 Like