LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   using openbox as bare WM : setting xdg default application to okular fails (https://www.linuxquestions.org/questions/linux-desktop-74/using-openbox-as-bare-wm-setting-xdg-default-application-to-okular-fails-4175567978/)

jtwdyp 01-26-2016 07:14 PM

using openbox as bare WM : setting xdg default application to okular fails
 
I'm using openbox as a window manager without any desktop environment on multiple Linux distributions. But at the moment I'm using Mageia Linux Release 5. Most of the time I don't notice xdg because I open those applications I haven't defined keybindings for in my ~/.config/openbox/rc.xml, either from the command line or with midnight commander. Which has it's own method of assigning default applications.

But at least some of the applications I use depend on xdg to open other applications. For example when the lyx document processor opens a pdf to view the current output of the current document. It was using the gimp.

{I like okular for this even though I can't stand the KDE environment itself since kde4. Never could stand gnome so I wound up using openbox}

I did some web searching and learned to test xdg in a terminal with
Code:

xdg-open testfile.pdf
which also opened the pdf with gimp.
After some more web searching I tried editing the file
~/.config/mimeapps.list (which hadn't specified a pdf application or hardly anything else)
I added one line so that it now contained:
Code:

[Default Applications]
inode/directory=pcmanfm.desktop
application/pdf=okular.desktop

[Added Associations]
inode/directory=pcmanfm.desktop;

This had no effect on the application used by xdg-open to open a pdf file.

After some more web searching I tried to follow the instructions on the Arch wiki:

This command did work to set the default to Evince {which is somewhat better than opening a pdf with the gimp. But I wanted okular}
Code:

xdg-mime default evince.desktop application/pdf
So I tried:
Code:

xdg-mime default okular.desktop application/pdf
But when I tested it with:
Code:

xdg-open testfile.pdf
I got a blank okular display window with this error message:

http://oi64.tinypic.com/29olh80.jpg

Yet from the same xterm {in the same directory}
Code:

okular testfile.pdf
opens the test pdf properly with okular.

As does selecting the file in midnight commander and hitting Enter with this:

Code:

# PDF
type/^PDF
        Open=(okular %f &)

in my ~/.config/mc/mc.ext file...

What can I do {besides installing the entire KDE desktop environment} to get xdg-open to succesfuly open a pdf with okular???

ondoho 01-27-2016 01:06 PM

i think you are very close to solving this.

Quote:

Originally Posted by jtwdyp (Post 5487773)
So I tried:
Code:

xdg-mime default okular.desktop application/pdf
But when I tested it with:
Code:

xdg-open testfile.pdf
I got a blank okular display window with this error message:
http://oi64.tinypic.com/29olh80.jpg

i wonder where the extra options "--icon okular -caption Okular" come from?(*) why would xdg-open put them there?
maybe the solution can be found in the okular.desktop file?

(*)
test: try it from a terminal, with these options added to the command line - do you get the same error?

jtwdyp 01-28-2016 01:38 AM

Quote:

Originally Posted by ondoho (Post 5488098)
i think you are very close to solving this.

i wonder where the extra options "--icon okular -caption Okular" come from?(*) why would xdg-open put them there?
maybe the solution can be found in the okular.desktop file?

You were right. I did a:
Code:

# vim $(find / -iname okular.desktop)
found and truncated the Exec line.

Code:

# Exec=okular %U %i -caption %c
Exec=okular %U

Now xdg-open works for pdf files... And LyX can generate and open pdf output.

Thank You!

ondoho 01-28-2016 02:13 PM

you're welcome!


All times are GMT -5. The time now is 03:14 AM.