Open tsuliwaensis opened 3 years ago
Finicky does not currently support this, would require browser plugins to be written for each browser that should trigger this. Finicky has basic (unused/untested) support for urls to be opened with the finicky://
or finickys://
protocols that could be used for this.
My use case is a bit different, but related: I need to be able to force a given URL to be open in one browser or another, e.g.: 'github.com' is handled by Chrome, but I might want to force it in Safari, or Firefox.
As a workaround I managed to do the following:
excuse the ugly code
module.exports = {
handlers: [
{
match: ({ url }) => url.hash.include("finicky:"),
browser: ({ url }) => {
return switch(url.hash.replace(/finicky:/g, '')) {
case 'Chrome':
'Google Chrome.app'
break
case 'Safari':
'Safari.app'
break
case 'Firefox':
'Firefox.app'
break
default:
'Google Chrome.app'
break
}
}
},
{
match: ({ url }) => url.hostname === "github.com",
browser: "Google Chrome.app"
},
],
Expected behaviour:
It's not ideal, and it'll break if the URL already contains an anchor, but allows me to manipulate the target browser in other tools simply by adding an anchor. I haven't found a way to remove the anchor in the handler. I can't do it in the rewrite
section, as then it wouldn't match my custom handler.
Before Finicky I was using Choosy. It has an API that enables this kind of setup more cleanly: https://www.choosyosx.com/api
I would also like this feature, to have links in Chrome open up in Safari.
I created a Bookmarklet that emulates Choosy or Bumpr functionality. Granted it's really basic but launches a popup from which you can select a new browser for the current page's URL: https://github.com/johnste/finicky/discussions/251
use browser extension tampermonkey or greasemonkey with this scrip
// ==UserScript==
// @name Open Link in Finicky
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const selectors = [
'a[href^="https://grafana.my-domain.com"]',
];
selectors.forEach(selector => {
document.querySelectorAll(selector).forEach(item => {
const [proto, url] = item.href.split('://')
// original protocol support
item.href = `finicky://finicky.open.${proto}/${url}`
// or use this to not use finicky rewrite
// it uses the http protocol
// item.href = `finicky://${url}`
})
})
// Finicky rewrite
// { // Open link in Finicky browser user script
// // finicky://finicky.open.{protocol}/{host}... to
// // {protocol}://host/...
// match: ({url}) => url.host.split('.').slice(0, -1).join('.') === 'finicky.open',
// url: ({url, urlString}) => `${ url.host.split('.')[2] }://${ urlString.replace(/^\w+:\/\/[^/]+\//, '') }`,
// }
})();
Is there a way to open a link in one browser in another browser? For example, if I want all links to Google Docs to open with Chrome while using Safari.