You are not logged in.
Hey!
I know that the first thing to do is search before bothering other people
and I did it a lot. Google, posts, how-to`s, wikis... I see my last chance in asking this community ![]()
I first tried in the newbie corner, but unfortunately no help there.
So here is my problem:
I use chromium as default browser and konversation for irc on lxde desktop. chromium uses xdg-open to associate files and links with programs. I tried everything I found but couldn`t get it to work. When I click on an IRC link, it asks me for opening the associated application, I confirm with yes and nothing happens. When trying to open an irc link from the terminal I get
xdg-open: no method available for opening 'irc://...'
I got it to work with mimeo and gconf, so please no suggestions in this direction, I would like to learn how to do it without it and so to learn it distribution and desktop independently.
For anyone looking for it, this is the working mimeo solution
$ yaourt -Sy mimeo xdg-utils-mimeo mime-type
$ nano /home/tom/.config/mimeo.conf
/usr/bin/konversation
^irc://
# there have to be exactly two spaces in front of ^irc://
This is the working solution in gnome using gconf:
$ gconftool-2 --set --type=string /desktop/gnome/url-handlers/irc/command 'konversation "%s"
$ gconftool-2 --set --type=bool /desktop/gnome/url-handlers/irc/enabled true
$ gconftool-2 --set --type=bool /desktop/gnome/url-handlers/irc/need-terminal false
This is what I tried in lxde without success:
$ yaourt -Sy mime-type xdg-utils
$ xdg-mime default konversation.desktop application/irc
$ xdg-mime default konversation.desktop x-scheme-handler/irc
$ xdg-mime default konversation.desktop application/x-xdg-protocol-irc$ nano /usr/share/applications/kde4/konversation.desktop
MimeType=application/irc;x-scheme-handler/irc;x-xdg-protocol-irc$ nano /usr/share/mime/packages/irc.xml
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/irc">
<comment>irc url</comment>
<magic priority="50">
<match value="%irc://-" type="string" offset="0"/>
</magic>
<alias type="application/irc"/>
</mime-type>
</mime-info>$ update-mime-database /usr/share/mime/
I appreciate every suggestion.
Please explain as understandable as possible, at best with all commands and paths to the files!
Thanks in advance
Tom
Offline
I've banging my head against this wall too. Have you tried the assogiate app? I can't build it.
LE: after trying your method I get this:
update-desktop-database
Error in file "/usr/share/applications/mumble.desktop": "x-xdg-protocol-mumble" is an invalid MIME type ("x-xdg-protocol-mumble" does not contain a subtype)And it works, partially. It launches the application but it doesn't connect to the server.
Last edited by z0id (2011-08-11 16:40:29)
/usr/bin/drinking
Offline
I know this is an old post, but for anyone googling to open an irc link with chrome using xdg-open (as I have been), I found a solution. The below is for a particular user, paths will be different for all users.
For xchat (if you want to use another irc client sub in the correct command line parameters below)
1. Add irc to xdg-open associations:
sudo gedit ~/.local/share/applications/mimeapps.listAdd line:
x-scheme-handler/irc=custom_xchat.desktopor use xdg-mime to do the same thing
2. Create the xchat launcher .desktop file:
~/.local/share/applications/custom_xchat.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Xchat Connecting server launcher
Comment=Chat with other people using Internet Relay Chat
Exec=/usr/bin/custom_xchat %U
Icon=xchat
Terminal=false
Type=Application
Categories=Network;IRCClient;GTK;
StartupNotify=true
X-Desktop-File-Install-Version=0.19
Mime type=x-scheme-handler/irc/usr/bin/custom_xchat is the script which will launch the IRC client of your choice, it can be placed/named as you choose. If you do put it in /usr/bin, make sure that you set it to have appropriate execution privileges (otherwise just put it in your home directory somewhere)
My xchat launcher script is just an excerpt from purple_url_handler (written in python), because I couldn't be bothered. If you want nickserv handling and the works, you can make something to extract info that from the link and add it to the call function using appropriate arguments for your IRC client. This simple script just connects to the server (and tries to join a room if it's in the link).
/usr/bin/custom_xchat
#!/usr/bin/python
import dbus
import re
import sys
from subprocess import call
def ircxchat(uri):
protocol = "prpl-irc"
match = re.match(r"^irc:(//([^/]*))?/?([^?]*)(\?(.*))?", uri)
if not match:
print "Invalid irc URI: %s" % uri
return
call(["xchat", "--existing", "--url=%s"%uri])
def main(argv=sys.argv):
if len(argv) != 2 or argv[1] == "--help" or argv[1] == "-h":
print "Usage: %s URI" % argv[0]
print "Example: %s \"xmpp:romeo@montague.net?message\"" % argv[0]
if len(argv) != 2:
sys.exit(1)
else:
return 0
uri = argv[1]
type = uri.split(":")[0]
try:
if type == "irc":
ircxchat(uri)
else:
print "Unknown protocol: %s" % type
except dbus.DBusException, e:
print "Error: %s" % (e.message)
sys.exit(1)
if __name__ == "__main__":
main()And that's it! When you click on an irc:// link in Chrome, xdg-open will will execute the above script and xchat will open and connect to the server.
Offline