見出し画像

Finicky.js を使うと特定ドメインのリンククリックしたときだけ別ブラウザで開けるよ

低気圧で死んでいます₍ ᐢ. ̫ .ᐢ ₎


今回は

「ブラウザはChrome/Firefox/Brave使ってるけどgithub.com ドメインのリンクだけSafariで開きてぇ〜」

とかになったのでいい感じのツール無いかなぁ記事です。

※アプリをインストールして常に開いてないといけないやつは嫌でした。

使い方はこんな感じ

1. リリースされてるZIPをインスコ(そしてunzip)

2. 規定のブラウザをFinickyに

スクリーンショット 2020-06-19 18.08.06

3. ホームディレクトリに .finicky.js ファイルを作ります。

home$ touch ~/.finicky.js

4. このファイルにスクリプトを書いていきます₍ ᐢ. ̫ .ᐢ ₎

module.exports = {
  // デフォルトはBrave Browser, Google ChromeやFirefoxでもいける
   defaultBrowser: 'Brave Browser',
   handlers: [
       {
           //match: finicky.matchHostnames([“youtube.com”, “facebook.com”]),
           // github.comドメイン以下はSafariで開く🎉
           match: ['github.com*'],
           browser: 'Safari'
       }
   ]
};

successfully が出たら成功です🎉

スクリーンショット 2020-06-19 18.11.11

公式のサンプルやドキュメントが充実してるので、もっと色々カスタムしたい人はこちらも₍ ᐢ. ̫ .ᐢ ₎

// ~/.finicky.js

module.exports = {
 defaultBrowser: "Google Chrome",
 rewrite: [
   {
     // Redirect all urls to use https
     match: ({ url }) => url.protocol === "http",
     url: { protocol: "https" }
   }
 ],
 handlers: [
   {
     // Open apple.com and example.org urls in Safari
     match: ["apple.com*", "example.org*"],
     browser: "Safari"
   },
   {
     // Open any url that includes the string "workplace" in Firefox
     match: /workplace/,
     browser: "Firefox"
   },
   {
     // Open google.com and *.google.com urls in Google Chrome
     match: [
       "google.com*", // match google.com urls
       finicky.matchDomains(/.*\.google.com/) // use helper function to match on domain only
     ],
     browser: "Google Chrome"
   }
 ]
};

じゃあね₍ ᐢ. ̫ .ᐢ ₎₍ ᐢ. ̫ .ᐢ ₎

この記事が気に入ったらサポートをしてみませんか?