I'm currently trying to modify the default URL handling behavior in OS X. I would like, when clicking on any link outside of a web browser, to copy this URL to the pasteboard instead of opening it in the default web browser – for instance, clicking a link in a Skype conversation should copy this URL to the OS X pasteboard instead of opening it in Firefox (which is currently my default web browser).
I have thought about solutions, but I’m currently unable to implement one. If I can create an application that puts URLs into the pasteboard that are sent to it, and can set this application as the default web browser, I would be able to achieve my goal.
I created an application with Automator that executes the shell command
pbcopy and have set this application as my default web browser, but I didn’t get the expected result. I did some testing and I can confirm that the application runs on clicking on a link, however, I cannot get the URL passed to the application / shell script. I tried both stdin or a passed argument, but without success.
Is there a way for an application created with Automator to retrieve a clicked URL and send it to
pbcopy, when that application is set as a (default) handler for URLs?
Alternatively, is there a better way to create a fake web browser that takes the input and puts it in the pasteboard than Automator? Or is there any other way that I can achieve my goal without a custom application / script?