Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to open channels in servers specified in irc:// links in XChat, but directly pointing to XChat binary (in Firefox) did not work - the window to choose servers appears as usual. I don't know how to associate irc:// links with XChat in Chromium.

share|improve this question
    
there is a link here that describes various workarounds for older versions of firefox and xchat - maybe it still works? ubuntuforums.org/archive/index.php/t-25372.html –  fossfreedom Aug 4 '11 at 8:29
    
Hmm, if xchat --existing --url=$@ could be converted to a Terminal command... I don't want to create a script. Too much of a chore to do it every time I format the PC. –  Oxwivi Aug 4 '11 at 9:07
    
possibly something like bash -c "xchat --existing --url=$@" ? –  fossfreedom Aug 4 '11 at 9:18
    
Well, the Bash script worked, couldn't use the Terminal command. So if you can post it as an answer, I can be done with this question. –  Oxwivi Sep 6 '11 at 17:25
add comment

2 Answers 2

up vote 7 down vote accepted

One possible solution is to make a little script to open the irc chanel in an existing xchat, and pass that to Firefox.

For example - make a file in /usr/bin called xchat-firefox and put in it:

#!/bin/bash
xchat --existing --url=$@

Add executable permission to the script:

sudo chmod +x xchat-firefox

Now using the menu option Edit-Preferences-Applications Tab in Firefox select "xchat-firefox" for the "irc" content-type.

source 1 & source 2

share|improve this answer
add comment

Fossfreedom's method works great, but it is a per-app solution. Granted, firefox/chromium is the most common use case, but it is easy to make a system-wide solution so it would automatically works for all apps automatically, with no need to configure each one.

The solution is to create an alternative .desktop file associating xchat with the irc:// uri scheme. This will automatically make the whole desktop (and any app) see XChat as an IRC handler.

Copy xchat launcher so we can edit it:

cp /usr/share/applications/xchat.desktop ./xchat-irc-handler.desktop

Edit its contents, adding MimeType and NoDisplay, and replacing Exec to match this:

Exec=xchat --existing --url=%u
MimeType=x-scheme-handler/irc;
NoDisplay=true

Now install the file. This can be done for your current user only or for all users (just prepend the command with sudo):

xdg-desktop-menu install --novendor ./xchat-irc-handler.desktop

And that's it! You can try results immediately, in Firefox, Chromium, or any application. Let's test it in terminal:

xdg-open 'irc://chat.freenode.org/#ubuntu'

Ta-da!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.