Vimperator の代替として名前が挙げられるも、果たして本邦でどのくらい使われているのか怪しい Tridactyl ですが、 設定ファイルを作ることができます。ただ、手順が少し面倒だったのでメモしておきます。
前提
- macOS 10.15
- OS によって手順が異なる可能性があります
- Firefox 76.0.1
- Tridactyl 1.18.1
手順
1. Native Messengerをインストールする
Tridactyl のコマンドラインに :nativeinstall
を入力します。
すると、以下のように表示されます。
Installation command copied to clipboard.
Please paste and run it in your shell to install the native messenger.【日本語訳】
インストールコマンドがクリップボードにコピーされました。
Native Messenger をインストールするには、シェルに貼り付けて実行してください。
指示されたとおり、シェルに貼り付けて実行します。
$ curl -fsSl https://raw.githubusercontent.com/tridactyl/tridactyl/master/native/install.sh -o /tmp/trinativeinstall.sh && bash /tmp/trinativeinstall.sh master
Installing manifest here: /Users/*****/Library/Application Support/Mozilla/NativeMessagingHosts/
Installing script here: XDG_DATA_HOME: /Users/*****/.local/share/tridactyl
Successfully installed Tridactyl native messenger!
Run ':native' in Firefox to check.
Tridactyl のコマンドラインに :native
を入力し、正常にインストールされたことを確認します。
Native messenger is correctly installed, version 0.1.11
2. 設定ファイルを作成する
設定ファイルのパスについては、 :help source
には以下のように記載されています。
If no argument given, it will try to open ~/.tridactylrc, ~/.config/tridactyl/tridactylrc or $XDG_CONFIG_HOME/tridactyl/tridactylrc in reverse order. You may use a _ in place of a leading . if you wish, e.g, if you use Windows.
【日本語訳】
(source コマンドに)引数が与えられなかった場合、(source コマンドは) ~/.tridactylrc 、 ~/.config/tridactyl/tridactylrc 、 $XDG_CONFIG_HOME/tridactyl/tridactylrc を逆順に開こうとします。また、例えば Windows を使っている場合のように、お望みならば、先頭の . の代わりに _ を使うこともできます。
今回は、 ~/.tridactylrc
を作成します。
YY
を押したときに、ページのタイトルと URL をヤンクする設定を追加します。1
bind YY composite js document.title + "\n" + document.URL | yank
-
bind キー コマンド
- キーにコマンドを紐付けます(キーを押したらコマンドが実行されるようにする)
-
composite コマンド1 | コマンド2
- パイプを実現します。コマンド1の戻り値が、コマンド2の標準入力になります
-
js JavaScript
- JavaScript を実行します
-
yank
- ヤンクです
3. 設定ファイルを読み込む
Tridactyl のコマンドラインに :source
を入力します。2
適当なページで YY
を押し、クリップボードにコピーされているかを確認します。例えば、Qiita のトップページならば、このようになります。
Qiita
https://qiita.com/
参考
-
Tridactyl Wiki
-
Tridactylのnative messengerを入れた - クマーなひとときv2
- Native Messenger について詳しい3