Assuming you are using Firefox, you can create a simple shell script to do this. There may be a similar mechanism for other browsers, but I am not familiar with those.
Open GEdit (or any other editor) and enter the following:
#! /bin/bash
aptInstall="$@"
aptInstall=${aptInstall#*:}
gnome-terminal -e "sudo apt-get install $aptInstall"
Save this script. I will refer to it as ~/apt_terminal.sh
.
- Open the terminal and run
chmod a+x ~/apt_terminal.sh
. This will make the script executable.
- Now open Firefox's Preferences and go to the "Applications" section. Find the "apt" content type.
- Select "Use other" under the "Action" heading for the "apt" content type and browse to the location of the script you just created.
Now apt:// URLs should open up in the terminal by prompting you for your password.
You may be able to modify the method provided in the link above to work with this script, but I don't have Chrome installed so I can't try it out at the moment.
– Andrew Johnson Dec 09 '12 at 23:30~/.local/share/applications/
and then runupdate-mime-database ~/.local/share/applications
so that the MIME handler info is cached. Installingapturl
might be a better option though. – dobey Dec 09 '12 at 23:31