You are not logged in.

#1 2020-10-23 04:53:49

phantom_rehan
Member
Registered: 2020-10-05
Posts: 5

Use different application to open URLs using kfmclient

I use i3 with KDE. I have been using termite as my terminal for a week now and it has this nice feature where I click on URLs to open them. Problem is that I want it to open URLs using different applications. If its a image, i want it to use feh. I see that clicking on a URL  a program called kfmclient is called, which is part of KDE I believe. I would either like to use a different application to open URLs or completely disable this behavior. I tried finding resources for configuring kfmclient, but couldn't find any helpful ones.

Last edited by phantom_rehan (2020-10-26 09:08:41)

Offline

#2 2020-10-23 06:46:30

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,742

Re: Use different application to open URLs using kfmclient

You need to set your default applications properly, as a GTK application termite should use GAppinfo and thus the xdg specification

https://wiki.archlinux.org/index.php/De … plications

https://wiki.archlinux.org/index.php/XD … plications

Online

#3 2020-10-23 09:14:57

phantom_rehan
Member
Registered: 2020-10-05
Posts: 5

Re: Use different application to open URLs using kfmclient

I was able to get firefox working by changing

x-scheme-handler/http=kfmclient_html.desktop

to

x-scheme-handler/http=firefox.desktop

and it worked, thanks!

Last edited by phantom_rehan (2020-10-24 04:57:11)

Offline

#4 2020-10-23 12:27:33

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,742

Re: Use different application to open URLs using kfmclient

Cool, please mark as [SOLVED] by editing the title in your first post.

PS. We don't use markdown but BBCode, there's a link for that under every comment box, for code tags you'd use

[code]code[/code]

Online

#5 2020-10-26 09:08:26

phantom_rehan
Member
Registered: 2020-10-05
Posts: 5

Re: Use different application to open URLs using kfmclient

Oh this actually isn't solved. I thought it was feh opening images, but firefox open images. I have set

image/*=feh.desktop

in my ~/.config/mimeapps.list, but it still doesn't seem to use feh to open images. It uses firefox. Also, I do have feh.desktop in /usr/share/applications/

Last edited by phantom_rehan (2020-10-26 09:09:14)

Offline

#6 2020-10-26 09:44:31

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,742

Re: Use different application to open URLs using kfmclient

I'm not finding anything that suggests globbing on mimetypes to be supported, did you just assume that or have a reference that it should work?

What you can do is copy the possible mimetypes from the spec list: https://www.iana.org/assignments/media- … html#image

Online

#7 2020-10-26 10:54:04

progandy
Member
Registered: 2012-05-17
Posts: 5,196

Re: Use different application to open URLs using kfmclient

If you have an http-url it will always be opened with a browser. There is no way to differentiate between filetypes for web resources before fetching them.
Edit: and most applications cannot handle anything except the local filesystem anyways.

Last edited by progandy (2020-10-26 10:55:31)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#8 2020-10-26 11:58:40

phantom_rehan
Member
Registered: 2020-10-05
Posts: 5

Re: Use different application to open URLs using kfmclient

Well I do know some programs can actually differentiate between filetypes, using mailcap, and was hoping for a similar solution.
And as for "globbing" filetypes, it seemed rather convenient.

Last edited by phantom_rehan (2020-10-26 11:59:56)

Offline

#9 2020-10-26 12:19:35

progandy
Member
Registered: 2012-05-17
Posts: 5,196

Re: Use different application to open URLs using kfmclient

Those programs either only operate on the local filesystem or download everything to local storage and only then choose how to open the file.

You can set a custom program to open URLs in the termite config that does the same.

Last edited by progandy (2020-10-26 12:21:55)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#10 2020-10-26 13:04:52

phantom_rehan
Member
Registered: 2020-10-05
Posts: 5

Re: Use different application to open URLs using kfmclient

So I understand that I should set browser=name_of_program in my termite config. And could you reccomend such a program that operates based on mailcap, or should I write my own script?

Offline

#11 2020-10-26 14:25:46

progandy
Member
Registered: 2012-05-17
Posts: 5,196

Re: Use different application to open URLs using kfmclient

You'll have to write your own. For file:// URLs and local paths it is trivial, just call xdg-open with the url (that uses the xdg mimetype associations instead of mailcap). It still opens all http urls with a browser, though. For that you'll have to add download and so on.

Last edited by progandy (2020-10-26 14:26:07)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

Board footer

Powered by FluxBB