View previous topic :: View next topic |
Author |
Message |
McLink Apprentice
Joined: 02 Feb 2008 Posts: 181 Location: /dev/chair
|
Posted: Wed Aug 15, 2018 1:50 pm Post subject: [SOLVED] Changing Okular's URL handler |
|
|
Although I don't use KDE as a whole (or any other full desktop environment), Okular is my main PDF reader. I'm having a mildly annoying problem with it, though: whenever I click a link, it tries to open it with /usr/lib64/firefox/firefox, which does not exist (I don't even have Firefox installed). I can't find any relevant options in Okular's settings to change its default browser. Copying the link address and using xdg-open launches my preferred browser as expected. I used strace -e trace=open okular to get a list of files/directories opened by Okular, but grepping those files for 'firefox' also came up empty (save for /usr/share/icons/HighContrast/icon-theme.cache, which I don't think is the culprit).
So does anyone have an idea how to get Okular to open links with another browser (apart from putting a shell script at /usr/lib64/firefox/firefox, which is an immensely ugly hack if you ask me)?
Cheers.
Solved by editing /usr/share/applications/mimeinfo.cache. _________________
Mc'abit wrote: | Islam isn't the problem, religion is. |
Last edited by McLink on Fri Aug 17, 2018 10:11 am; edited 2 times in total |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2034 Location: United Kingdom
|
Posted: Wed Aug 15, 2018 3:08 pm Post subject: |
|
|
I'm not sure about using Okular in a non-KDE environment, but perhaps the following may help you:
To check the current association for PDF files:
Code: | $ xdg-mime query filetype sample.pdf
application/pdf |
To find the Desktop Configuration File of the default application for opening PDF files:
Code: | $ xdg-mime query default application/pdf
okularApplication_pdf.desktop
$ locate okularApplication_pdf.desktop
/usr/share/applications/okularApplication_pdf.desktop |
The file /usr/share/applications/okularApplication_pdf.desktop contains the following, which you could create if it does not already exist:
Code: | [Desktop Entry]
MimeType=application/pdf;application/x-gzpdf;application/x-bzpdf;application/x-wwf;
Terminal=false
Name=Okular
Name[ar]=اوكلار
Name[ast]=Okular
Name[bg]=Okular
Name[bs]=Okular
Name[ca]=Okular
Name[ca@valencia]=Okular
Name[cs]=Okular
Name[da]=Okular
Name[de]=Okular
Name[el]=Okular
Name[en_GB]=Okular
Name[eo]=Okular
Name[es]=Okular
Name[et]=Okular
Name[eu]=Okular
Name[fi]=Okular
Name[fr]=Okular
Name[ga]=Okular
Name[gl]=Okular
Name[hne]=ओकुलर
Name[hr]=Okular
Name[hu]=Okular
Name[ia]=Okular
Name[is]=Okular
Name[it]=Okular
Name[ja]=Okular
Name[kk]=Okular
Name[km]=Okular
Name[ko]=Okular
Name[ku]=Okular
Name[lt]=Okular
Name[lv]=Okular
Name[mr]=ओक्युलर
Name[nb]=Okular
Name[nds]=Okular
Name[nl]=Okular
Name[nn]=Okular
Name[pa]=ਓਕੁਲਾਰ
Name[pl]=Okular
Name[pt]=Okular
Name[pt_BR]=Okular
Name[ro]=Okular
Name[ru]=Okular
Name[si]=Okular
Name[sk]=Okular
Name[sl]=Okular
Name[sq]=Okular
Name[sr]=Окулар
Name[sr@ijekavian]=Окулар
Name[sr@ijekavianlatin]=Okular
Name[sr@latin]=Okular
Name[sv]=Okular
Name[th]=โอกูลาร์
Name[tr]=Okular
Name[ug]=Okular
Name[uk]=Okular
Name[x-test]=xxOkularxx
Name[zh_CN]=Okular
Name[zh_TW]=文件檢視_Okular
GenericName=Document Viewer
GenericName[ar]=عارض المستندات
GenericName[ast]=Visor de documentos
GenericName[bg]=Преглед на документи
GenericName[bs]=Prikazivač dokumenata
GenericName[ca]=Visualitzador de documents
GenericName[ca@valencia]=Visualitzador de documents
GenericName[cs]=Prohlížeč dokumentů
GenericName[da]=Dokumentfremviser
GenericName[de]=Dokumentenbetrachter
GenericName[el]=Προβολέας εγγράφων
GenericName[en_GB]=Document Viewer
GenericName[eo]=Dokumenta rigardilo
GenericName[es]=Visor de documentos
GenericName[et]=Dokumendinäitaja
GenericName[eu]=Dokumentu ikustailea
GenericName[fa]=مشاهدهگر سند
GenericName[fi]=Asiakirjakatselin
GenericName[fr]=Afficheur de documents
GenericName[ga]=Amharcán Cáipéisí
GenericName[gl]=Visor de documentos
GenericName[hi]=दस्तावेज़ प्रदर्शक
GenericName[hne]=कागद प्रदर्सक
GenericName[hr]=Preglednik dokumenata
GenericName[hu]=Dokumentumnézegető
GenericName[ia]=Visor de documento
GenericName[is]=Skjalaskoðari
GenericName[it]=Visore di documenti
GenericName[ja]=文書ビューア
GenericName[kk]=Құжатты қарау құралы
GenericName[km]=កម្មវិធីមើលឯកសារ
GenericName[ko]=문서 뷰어
GenericName[ku]=Nîşanderê Belgeyan
GenericName[lt]=Dokumentų žiūryklė
GenericName[lv]=Dokumentu skatītājs
GenericName[mr]=दस्तऐवज प्रदर्शक
GenericName[nb]=Dokumentviser
GenericName[nds]=Dokmentkieker
GenericName[ne]=कागजात दर्शक
GenericName[nl]=Documentenviewer
GenericName[nn]=Dokumentvisar
GenericName[oc]=Visualizaire de documents
GenericName[pa]=ਡੌਕੂਮੈਂਟ ਦਰਸ਼ਕ
GenericName[pl]=Przeglądarka dokumentów
GenericName[pt]=Visualizador de Documentos
GenericName[pt_BR]=Visualizador de documentos
GenericName[ro]=Vizualizor de documente
GenericName[ru]=Просмотр документов
GenericName[sk]=Prehliadač dokumentov
GenericName[sl]=Pregledovalnik dokumentov
GenericName[sq]=Shikues dokumentesh
GenericName[sr]=Приказивач докумената
GenericName[sr@ijekavian]=Приказивач докумената
GenericName[sr@ijekavianlatin]=Prikazivač dokumenata
GenericName[sr@latin]=Prikazivač dokumenata
GenericName[sv]=Dokumentvisare
GenericName[th]=เครื่องมือแสดงเอกสาร
GenericName[tr]=Belge Gösterici
GenericName[ug]=پۈتۈك كۆرگۈ
GenericName[uk]=Переглядач документів
GenericName[x-test]=xxDocument Viewerxx
GenericName[zh_CN]=文档查看器
GenericName[zh_TW]=文件檢視器
Comment=Universal document viewer
Comment[ast]=Visor universal de documentos
Comment[ca]=Visualitzador universal de documents
Comment[ca@valencia]=Visualitzador universal de documents
Comment[cs]=Univerzální prohlížeč dokumentů
Comment[da]=Universel dokumentfremviser
Comment[de]=Universeller Dokumentenbetrachter
Comment[el]=Καθολικός προβολέας εγγράφων
Comment[en_GB]=Universal document viewer
Comment[es]=Visor de documentos universal
Comment[et]=Universaalne dokumendinäitaja
Comment[fi]=Yleinen asiakirjakatselin
Comment[fr]=Afficheur de document universel
Comment[gl]=Visor de documentos universal
Comment[ia]=Visor de documento universal
Comment[is]=Fjölhæfur skjalaskoðari
Comment[it]=Visore di documenti universale
Comment[ko]=만능 문서 뷰어
Comment[nl]=Universele documentviewer
Comment[nn]=Dokumentvisar for mange format
Comment[pl]=Wszechstronna przeglądarka dokumentów
Comment[pt]=Visualizador de documentos universal
Comment[pt_BR]=Visualizador de documentos universal
Comment[ru]=Универсальная программа просмотра документов
Comment[sk]=Univerzálny prehliadač dokumentov
Comment[sl]=Vsestranski pregledovalnik dokumentov
Comment[sr]=Универзални приказивач докумената
Comment[sr@ijekavian]=Универзални приказивач докумената
Comment[sr@ijekavianlatin]=Univerzalni prikazivač dokumenata
Comment[sr@latin]=Univerzalni prikazivač dokumenata
Comment[sv]=Generell dokumentvisare
Comment[tr]=Evrensel belge görüntüleyici
Comment[uk]=Універсальний переглядач документів
Comment[x-test]=xxUniversal document viewerxx
Comment[zh_CN]=通用文档查看器
Comment[zh_TW]=通用文件檢視器
Exec=okular %U
Icon=okular
Type=Application
InitialPreference=8
Categories=Qt;KDE;Graphics;Viewer;
X-KDE-Keywords=PDF, Portable Document Format
X-KDE-Keywords[ar]=PDF, Portable Document Format
X-KDE-Keywords[ast]=PDF, formatu de documentu portátil
X-KDE-Keywords[bg]=PDF, Portable Document Format
X-KDE-Keywords[bs]=PDF, Portable Document Format
X-KDE-Keywords[ca]=PDF, Format de document portable
X-KDE-Keywords[ca@valencia]=PDF, Format de document portable
X-KDE-Keywords[cs]=PDF, Portable Document Format
X-KDE-Keywords[da]=PDF,Portable Document Format
X-KDE-Keywords[de]=PDF, Portable Document Format
X-KDE-Keywords[el]=PDF, Portable Document Format
X-KDE-Keywords[en_GB]=PDF, Portable Document Format
X-KDE-Keywords[es]=PDF, Formato de Documento Portable
X-KDE-Keywords[et]=PDF, Portable Document Format
X-KDE-Keywords[fi]=PDF, Portable Document Format
X-KDE-Keywords[fr]=PDF, Portable Document Format
X-KDE-Keywords[ga]=PDF, Portable Document Format
X-KDE-Keywords[gl]=PDF, Formato portátil de documentos
X-KDE-Keywords[hu]=PDF, Portable Document Format
X-KDE-Keywords[ia]=PDF, Formato de Documento Portabile
X-KDE-Keywords[is]=PDF, Portable Document Format
X-KDE-Keywords[it]=PDF, Portable Document Format, formato per documenti portabile
X-KDE-Keywords[ja]=PDF
X-KDE-Keywords[kk]=PDF, Portable Document Format
X-KDE-Keywords[km]=PDF, Portable Document Format
X-KDE-Keywords[ko]=PDF, Portable Document Format
X-KDE-Keywords[lt]=PDF, Portable Document formatas
X-KDE-Keywords[lv]=PDF, Portable Document formāts
X-KDE-Keywords[mr]=PDF, Portable Document Format
X-KDE-Keywords[nb]=PDF, Portabelt Dokument Format
X-KDE-Keywords[nds]=PDF, Porteerbor Dokmentformaat
X-KDE-Keywords[nl]=PDF, Portable Document Format
X-KDE-Keywords[nn]=PDF, Portabelt dokumentformat
X-KDE-Keywords[pa]=PDF, ਪੋਰਟੇਬਲ ਡੌਕੂਮੈਂਟ ਫਾਰਮੈਟ
X-KDE-Keywords[pl]=PDF, Przenośny Format Dokumentu
X-KDE-Keywords[pt]=PDF, Formato de Documento Portável
X-KDE-Keywords[pt_BR]=PDF, Formato de documento portável
X-KDE-Keywords[ro]=PDF, Portable Document Format
X-KDE-Keywords[ru]=PDF, Portable Document Format
X-KDE-Keywords[sk]=PDF, Portable Document Format
X-KDE-Keywords[sl]=PDF, Portable Document Format
X-KDE-Keywords[sr]=PDF, Portable Document Format,ПДФ
X-KDE-Keywords[sr@ijekavian]=PDF, Portable Document Format,ПДФ
X-KDE-Keywords[sr@ijekavianlatin]=PDF, Portable Document Format,PDF
X-KDE-Keywords[sr@latin]=PDF, Portable Document Format,PDF
X-KDE-Keywords[sv]=PDF, Portabelt dokumentformat
X-KDE-Keywords[tr]=PDF, Taşınabilir Belge Biçimi
X-KDE-Keywords[uk]=PDF,Portable Document Format,пдф
X-KDE-Keywords[x-test]=xxPDFxx,xx Portable Document Formatxx
X-KDE-Keywords[zh_CN]=PDF, Portable Document Format,开放文档格式
X-KDE-Keywords[zh_TW]=PDF, Portable Document Format
NoDisplay=true |
The permissions and ownership of the Desktop Configuration file are as follows:
Code: | $ ls -la /usr/share/applications/okularApplication_pdf.desktop
-rwxr-xr-x 1 root root 8512 Jul 9 23:49 /usr/share/applications/okularApplication_pdf.desktop |
To associate PDF files with Okular:
Code: | $ xdg-mime default okularApplication_pdf.desktop application/pdf |
_________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.
Fitzcarraldo's blog |
|
Back to top |
|
|
McLink Apprentice
Joined: 02 Feb 2008 Posts: 181 Location: /dev/chair
|
Posted: Fri Aug 17, 2018 10:10 am Post subject: |
|
|
Please read the question again, because that has absolutely nothing to do with what I asked. PDFs are associated with Okular just fine.
I found that the xdg utils look at ~/.local/share/applications/mimeapps.list, but ~/.config/mimeapps.list also exists. I removed it, and now Okular opens links with Google Chrome, which is also not what I want. However, symlinking ~/.config/mimeapps.list to ~/.local/share/applications/mimeapps.list still doesn't let Okular open links with my preferred browser for some reason.
However, I just managed to fix it by editing /usr/share/applications/mimeinfo.cache. _________________
Mc'abit wrote: | Islam isn't the problem, religion is. |
|
|
Back to top |
|
|
lyallp Veteran
Joined: 15 Jul 2004 Posts: 1557 Location: Adelaide/Australia
|
Posted: Thu Nov 19, 2020 2:22 am Post subject: |
|
|
Whilst Fitzcarraldo did not answer the question, apparently, it did answer mine, I found the response complete and informative and it worked for me. _________________ ...Lyall |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|