LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 01-26-2016, 07:14 PM   #1
jtwdyp
Member
 
Registered: Apr 2011
Distribution: antiX, Mageia, OpenSUSE, etc... I multi-boot
Posts: 36

Rep: Reputation: 0
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???
 
Old 01-27-2016, 01:06 PM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
i think you are very close to solving this.

Quote:
Originally Posted by jtwdyp View Post
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?
 
Old 01-28-2016, 01:38 AM   #3
jtwdyp
Member
 
Registered: Apr 2011
Distribution: antiX, Mageia, OpenSUSE, etc... I multi-boot
Posts: 36

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ondoho View Post
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!
 
Old 01-28-2016, 02:13 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
you're welcome!
 
  


Reply

Tags
defaults, okular, openbox


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set default page orientation in Okular for printing jjscott Linux - Desktop 9 08-16-2016 06:48 AM
Okular not respecting CUPS default settings moosejaw Slackware 2 01-11-2016 09:20 PM
Okular fails to print using the proper paper lay-out talo Slackware 2 11-05-2015 07:15 AM
KDE + Openbox = no application menus and no default programs. Rookie1337 Linux - Newbie 2 04-06-2013 01:24 PM
Openbox autostart.sh and setting alias on openbox start Jelloir Linux - Desktop 1 07-03-2011 03:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 07:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration