Xdg-open (or kde-open) doesn't work when called from emacs

When I run xdg-open xyz.pdf in Konsole, Okular opens the file without any issue.

When I run xdg-open xyz.pdf in emacs eshell, my cursor blinks with the Okular icon for a few seconds and then nothing happens.

When I run okular xyz.pdf in emacs eshell, Okular opens.

In both 2nd and 3rd case, I get a warning: Qt session management error, could not open network socket

My emacs workflow involves opening a lot of pdf externally and by default the emacs packages use the xdg-open command, which is not working. Any idea how to troubleshoot this?

1 Like