Ubuntu – How to open a *.pdf in an already existing instance of Okular (independent of in which workspace that instance resides)

kdepdfworkspaces

acroread and qpdfview already perform as desired: if an instance of acroread or qpdfview, resp., is already running this instance will open any pdf files, irrespective of the workspace from which these files are "launched".

Now here's the catch: okular, alas, behaves differently:

"launching" (read: opening) a pdf file from a given workspace will create a new instance of okular in that workspace, unless that particular workspace already has an instance of okular up and running.

Anything I can add to /usr/bin/okular to do the trick?

man okular doesn't give any hints to this and also from within okular I see no indicative option in the native settings.

Best Answer

I recently wanted to have the same functionality. Here is the simplest solution I could find:

Open Okular GUI. Navigate to Settings > Configure Okular. In General, under Program Features, check the 'Open new files in tabs' option. Click Apply. Click OK.

Then on your terminal, run okular file1.pdf file2.pdf fileN.pdf.

That code should open all your files in the same Okular window in different tabs. This method works across folders.