Sample Header Ad - 728x90

How do I open files with flatpak okular from command line?

6 votes
4 answers
2918 views
I have an alias for okular installed with flatpak that is set up like this: alias okular="org.kde.okular" It opens up okular from the terminal. However if I try to open a file from the terminal with that alias e.g: okular document.pdf Then it doesn't work. What am I doing wrong? Is there a way to open a file in the terminal using okular flatpak, rather than using the GUI? ## update: So I found this [link](https://www.mankier.com/1/flatpak-run) : >--file-forwarding If this option is specified, the remaining arguments are scanned, and all arguments that are enclosed between a pair of '@@' arguments are interpreted as file paths, exported in the document store, and passed to the command in the form of the resulting document path. Arguments between '@@u' and '@@' are considered uris, and any file: uris are exported. The exports are non-persistent and with read and write permissions for the application. Surely this doesn't mean the only way to open files in the terminal using okular flatpak is to do something like this: flatpak run okular.kde.org --file-forwarding @/home/user/documents/document.pdf@ I can't do this for every pdf I want to open. How can I add this as an alias so that I dont't need to type very long commands when opening different pdfs?
Asked by bit (1176 rep)
Jun 21, 2018, 01:49 PM
Last activity: Oct 8, 2021, 09:00 PM