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 run Firefox with -no-remote so I can use multiple profiles. This means applications which try to open URLs don't work.

Can I setup some form of bash script that will notify me of the attempted URL request so I can manually copy/paste it into Firefox?

Was thinking all I needed to do was make a bash script then set it as the default browser, however in order to set the browser you seem to use update-alternatives which doesn't give the option of using a user made script.

$ sudo update-alternatives --config x-www-browser
There is only one alternative in link group x-www-browser: /usr/bin/firefox
Nothing to configure.
share|improve this question

1 Answer 1

up vote 4 down vote accepted

You can create a .desktop file for xmessage and specify in the MimeType field that it handles the x-scheme-handler/http and x-scheme-handler/https MIME types, with the argument of %U passed to xmessage. Something like this:

[Desktop Entry]
Name=HTTP/HTTPS Link Notifier
Exec=xmessage %U
Terminal=false
Type=Application
Categories=Network;WebBrowser;
MimeType=x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=false
NoDisplay=true

You need to place this file in $XDG_DATA_HOME/applications and run the following command:

update-desktop-database $XDG_DATA_HOME/applications

This will pop up a simple dialog with a text field with the URL inside, which you can copy and paste into your browser, and then close the dialog. You should then be able to choose this entry as your default browser in System Settings under Default Applications in the Details module.

share|improve this answer
    
How can I install this? I've stuck it under /usr/share/applications/ and can "Open With Other..." however it isn't appearing under update-alternatives –  Annan Apr 17 '12 at 0:16
    
Sorry, forgot to mention it and such. It won't appear as an alternative, no. If you want to use alternatives you'll have to do more complex changes, probably by building a package to do what you want, and such a solution would also affect other users on the system if there are any. Also, the GUI doesn't simply run x-www-browser as the default. –  dobey Apr 17 '12 at 2:28
    
Cool it worked! Thanks –  Annan Apr 17 '12 at 4:07

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.