「WeeChat」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(文字列「Tips and Tricks」を「ヒントとテクニック‎」に置換)
(→‎ガイド: リンクを更新)
 
(2人の利用者による、間の22版が非表示)
1行目: 1行目:
 
[[Category:Internet Relay Chat]]
 
[[Category:Internet Relay Chat]]
  +
[[Category:コンソールアプリケーション]]
 
[[en:WeeChat]]
 
[[en:WeeChat]]
 
{{Related articles start}}
 
{{Related articles start}}
22行目: 23行目:
 
== 設定 ==
 
== 設定 ==
   
  +
デフォルトでは、WeeChat は設定ファイルを [[XDG Base Directory|XDG directory]] に保存します。WeeChat はいつでもファイルを書き込む可能性があるため、これらのファイルを直接編集することはお勧めできません。[https://www.weechat.org/files/doc/stable/weechat_user.en.html#files_and_directories]
WeeChat を設定する方法は3つあります: WeeChat の内部コマンドを使用する; '''iset''' を使用する; もしくは .conf ファイルを直接編集する。WeeChat は終了時や {{ic|/save}} の実行時に自動的に設定を保存するため、エディタで .conf ファイルを編集したら、終了する前にコンソールから {{ic|/reload}} を実行するようにしてください。そうしないと、編集したところが元に戻ってしまいます。
 
   
  +
代わりに、[https://weechat.org/files/doc/devel/weechat_user.en.html#command_weechat_set /set コマンド] を使用する必要があります。WeeChat バッファウィンドウで {{ic|/set}} を実行すると、設定可能なすべてのオプションのリストを取得できます。デフォルトの設定可能なオプションは 600 近くあるため、ワイルドカード構文 (例として {{ic|/set irc.server.*}} または {{ic|/set *server*}}) を使用して検索できます。{{ic|/help}} コマンドを使用すると、各オプションのヘルプを表示できます。
=== 内部コマンド ===
 
   
  +
/help irc.server.libera.autoconnect
The {{ic|/set}} command follows this structure:
 
{{ic|/set.[file.name].[section].[directive]}}
 
   
  +
{{Tip|すべての設定ファイルを単一のディレクトリに置きたい場合 ({{ic|~/.weechat}} など)、このオプションを使用します: {{ic|$ weechat -d $HOME/.weechat}} または環境変数 {{ic|WEECHAT_HOME}}}}
You can get a list of all configurable options by typing {{ic|/set}} in the '''weechat''' buffer window. Since there are nearly 600 default configurable options, you can search through them with a wildcard syntax: {{ic|/set irc.server.*}} or {{ic|/set *server*}} as an example. You can get help on each option with the {{ic|/help}} command:
 
   
  +
== サーバーに接続 ==
/help irc.server.freenode.autoconnect
 
   
  +
IRC サーバーに接続するには、サーバーを追加してから {{ic|/connect}} を使用します:
=== 内部メニュー ===
 
   
  +
/server add libera irc.libera.chat/6697
For a more convenient method, install the '''iset''' script. If you have weechat 0.3.9, run:
 
  +
/connect libera
   
  +
詳細については、WeeChat のドキュメントと {{ic|/help server}} を参照してください。
/script install iset.pl
 
   
  +
{{Note|事前にサーバーを追加せずに、{{ic|/connect}} を使用した一時的なサーバー接続は許可されません。この機能を有効にするには、最初に {{ic|/set irc.look.temporary_servers on}} を使用します。}}
In older versions, use {{ic|/weeget install iset}}, or download [http://www.weechat.org/scripts/source/stable/iset.pl.html/ iset.pl] into your {{ic|~/.weechat/perl/autoload}} directory manually.
 
   
  +
== SSL の設定 ==
Afterwards, run
 
   
  +
[https://libera.chat/ libera] ([[IRC チャンネル|#archlinux]] を含む) を含む多くの IRC サーバーは SSL をサポートしています。
/iset
 
   
  +
{{ic|/server}} でサーバーを作成している場合は、SSL ポート (通常は 6697) と {{ic|-tls}} を行の最後に追加します。例えば:
to get a buffer with all configuration options.
 
   
  +
/server add libera irc.libera.chat/6697 -tls
=== 設定ファイル ===
 
   
  +
{{Note|一部のサーバーでは、{{ic|ssl_dhkey_size}} の値をより低い値に変更する必要があります。たとえば、Libera を使用している場合は、コマンド {{ic|/set irc.server.libera.tls_dhkey_size 1024}} または {{ic|/set irc.server.libera.tls_dhkey_size 1024}} コマンドで値を設定する必要があります。(サーバーログを参照)}}
WeeChat の .conf ファイルは {{ic|~/.weechat}} に保存されています。ファイルにコメントは付いていません。詳しい説明はプログラムの内部コマンドを使うか、WeeChat の [http://www.weechat.org/files/doc/stable/weechat_user.en.html ユーザーガイド] を見て下さい。
 
   
  +
== ヒントとテクニック‎ ==
{{Tip|in case you want to move {{ic|.weechat}} directory somewhere else (like in your ''$XDG_CONFIG_HOME''), use this option : {{ic|$weechat -d $XDG_CONFIG_HOME/weechat}}}}
 
   
== バーに接続 ==
+
=== アップグレ ===
   
  +
WeeChat は、IRC サーバーから切断せずにアップグレードできます (非 SSL 接続のみ):
{{Note| Using '''/connect''' to connect to a temporary server is disabled by default if you're using 1.1+ [https://weechat.org/files/releasenotes/ReleaseNotes-devel.html#_temporary_servers_disabled_by_default_with_connect Release Note]
 
   
  +
/upgrade
Enable by '''/set irc.look.temporary_servers on'''
 
   
  +
これにより、新しい WeeChat バイナリがロードされ、現在の設定が再ロードされます。
}}
 
   
  +
=== エイリアス ===
You can connect to a IRC server by using '''/connect'''.
 
   
  +
エイリアスを作成して、一般的に実行されるコマンドを簡素化できます。良い例は、Wraithan の '''Smart Filter''' エイリアスです。
/connect chat.freenode.net
 
   
  +
'''Smart Filter'''
Or if there is already a '''Server''' setup you can use:
 
   
  +
まず、Smart Filter を有効にする必要があります。
/connect freenode
 
   
  +
/set irc.look.smart_filter "on"
== サーバープロファイルの作成 ==
 
   
  +
次に、'''sfilter''' エイリアスを作成します。
If you plan on connecting to a server more than once it may be beneficial to create a '''Server'''.
 
   
  +
/alias sfilter filter add irc_smart_$server_$channel irc.$server.$channel irc_smart_filter *
/server add example irc.example.net/6667
 
   
  +
入力できるようになりました
Would create the server '''example''' which would connect to '''irc.example.net''' on port '''6667'''
 
   
  +
/sfilter
See the WeeChat documentation and '''/help server''' for more information.
 
   
  +
任意のバッファにある場合、Smart Filter はそのバッファに対してのみ有効になります。
== SSL の設定 ==
 
   
  +
次のエイリアスは、現在のバッファーで以前に有効化された Smart Filter を削除する。エイリアスを追加します:
Many IRC servers, including [https://freenode.net/ freenode] where [[IRC チャンネル|#archlinux]] is, support SSL.
 
   
  +
/alias rmsfilter filter del irc_smart_$server_$channel
If you're making a server with '''/server''', add the SSL port (usually 6697) and '''-ssl''' to the end of the line. For example:
 
   
  +
実行
/server add freenode chat.freenode.net/6697 -ssl
 
   
  +
/rmsfilter
You can do the same thing if using '''/connect'''.
 
   
  +
=== Exec コマンド ===
/connect chat.freenode.net/6697 -ssl
 
   
  +
"exec" という新しいプラグインが追加され、コマンドは {{ic|/exec}} です。外部コマンドを実行し、{{ic|-o}} オプションを使用して現在のバッファに出力を表示することも、ローカル (デフォルト) で出力を表示することもできます。
{{Warning|Some servers need the '''ssl_dhkey_size''' value changed to something lower. For example, if you're using freenode you'll need to set '''/set irc.server.freenode.ssl_dhkey_size 1024''' or '''/set irc.server.chat.freenode.net.ssl_dhkey_size 1024''' (see the server log)}}
 
   
  +
=== キーバインド ===
{{Note|Different servers may have a different port than 6697 - this is server specific.}}
 
   
  +
参照 {{ic|/help key}}
You may also want to change the location where WeeChat looks for trusted authorities (the default value is {{ic|%h/ssl/CAs.pem}} which translates to {{ic|~/.weechat/ssl/CAs.pem)}}:
 
   
  +
基本的な irssi スタイルのウィンドウスクロールを追加する例:
/set weechat.network.gnutls_ca_file "/etc/ssl/certs/ca-certificates.crt"
 
   
  +
/key bind meta-p /window page_up
== ヒントとテクニック‎ ==
 
  +
/key bind meta-n /window page_down
   
  +
vimode プラグインを使用している場合、デフォルトのバインディングのほとんどは機能せず、vim のような代替手段が必要になります。[https://github.com/GermainZ/weechat-vimode/#current-key-bindings バインディング] を確認してください。
=== アップグレード ===
 
   
  +
=== アイドル時に SSH の接続が切れる ===
WeeChat can be upgraded without disconnecting from the IRC servers (non-SSL connections only):
 
   
  +
SSH を使ってリモートシェルから WeeChat に接続している場合、例えば [[GNU Screen]] や [[tmux]] で WeeChat を実行している場合、アイドル状態でしばらくすると接続が切断されることがあります。この現象が発生する原因は複数ありますが、解決する最も簡単な方法はリモートシェル上の SSH 設定にこの設定を追加することで接続を強制的に維持することです。
/upgrade
 
   
  +
これは WeeChat 自体とは関係ありませんが、アイドル時に接続が切断されることは代替の [[irssi]] ではデフォルトで起こりません。
This will load the new WeeChat binary and reload the current configuration.
 
   
  +
{{hc|# /etc/ssh/sshd_config|2=
=== エイリアス ===
 
  +
ClientAliveInterval 300}}
   
  +
または、[https://mosh.org Mosh] をご覧ください。
Aliases can be created to simplify commonly executed commands. A nice example is Wraithan's '''smart filter''' alias:
 
   
  +
=== 絵文字 ===
'''Smart Filter'''
 
   
  +
絵文字はUnicodeセットの一部です。絵文字の要件:
First, we need to enable smart filters:
 
   
  +
* ターミナルエミュレータはユニコードと絵文字サブセットをサポートしている必要があります。
/set irc.look.smart_filter "on"
 
  +
* ターミナルエミュレータで使用するフォントは、絵文字サブセットに対応している必要があります。
   
  +
絵文字をサポートするターミナルの不完全なリスト:
Next, we will create the '''sfilter''' alias:
 
   
  +
* {{Pkg|xfce4-terminal}}
/alias sfilter filter add irc_smart_$server_$channel irc.$server.$channel irc_smart_filter *
 
  +
* [[alacritty]]
  +
* [[rxvt-unicode]]
   
  +
=== マウスのサポート ===
We can now type
 
   
  +
ターミナルエミュレータはマウススクロールイベントを通過し、weechat は [https://weechat.org/files/doc/stable/weechat_user.en.html#screen_layout スクロールイン領域] を通過します。
/sfilter
 
   
  +
* チャットエリア
in any buffer, and the smart filter will only be enabled for that buffer.
 
  +
* ニックネームリストバー
   
  +
==== tmux 内のマウス ====
The following alias will remove a previously enabled smart filter in the current buffer. Add the alias:
 
   
  +
[[tmux]] で実行する場合は、{{ic|~/.tmux.conf}} でマウスのサポートをオンにします。
/alias rmsfilter filter del irc_smart_$server_$channel
 
   
  +
set -g mouse on
and execute it by
 
   
  +
=== Matrix ===
/rmsfilter
 
   
  +
{{Pkg|weechat-matrix}} スクリプトを使用すると、[[Matrix]] サーバーに接続できます。それをインストールしてから、次のようにします:
=== Exec コマンド ===
 
A new plugin called "exec" has been added, with command {{ic|/exec}}. It will execute external command and can display output to the current buffer with the '''-o''' option or locally (default).
 
   
  +
# Weechat 内で {{ic|/script load weechat-matrix.py}} を実行してください、
=== キーバインド ===
 
  +
# [https://github.com/poljar/weechat-matrix#configuration weechat-matrix を設定] します。
  +
# Matrix チャンネルに参加するには、Matrix バッファ内で {{ic|/join}} コマンドを使ってください。
   
  +
WeeChat の起動時にスクリプトを自動的にロードするには、次のコマンドを実行します:
Some helpful bindings:
 
   
  +
$ mkdir -p ~/.local/share/weechat/python/autoload
To use ctrl-left/right arrow keys to jump to next/previous words on the input line:
 
  +
$ ln -s /usr/share/weechat/python/weechat-matrix.py -t ~/.local/share/weechat/python/autoload
   
  +
=== Slack ===
/key bind meta2-1;5D /input move_previous_word
 
/key bind meta2-1;5C /input move_next_word
 
   
  +
Slack のネイティブクライアントがあります: [https://github.com/rawdigits/wee-slack wee-slack]
=== アイドル時に SSH の接続が切れる ===
 
   
  +
=== デスクトップ通知 ===
If you're connecting to your WeeChat through a remote shell using SSH, for example running it in [[screen]] or [[tmux]] you might experience getting disconnected after a while when idle. There are multiple factors in play why this might happen, but the easiest way to change this is to force the connection to be kept alive by appending this to your SSH-configuration on the remote shell.
 
   
  +
メンションまたはプライベートメッセージのデスクトップ通知を受信するには、Petr Zemek による {{AUR|weechat-notify-send}} スクリプトを [[インストール]] して下さい。
This has nothing to do with WeeChat itself, but losing connection when idle won't happen with it's alternative [[irssi]] by default, and thus is a common situation for those converting to WeeChat.
 
   
  +
このスクリプトは {{Pkg|libnotify}} を使用しており、KDE ​​と Gnome の両方で動作します。
{{hc|# /etc/ssh/sshd_config|2=
 
ClientAliveInterval 300}}
 
   
  +
組み込みの {{ic|trigger}} プラグインを使用する別の方法は、{{ic|trigger.trigger.beep.command}} の値を設定することです。
Or have a look at [http://mosh.mit.edu/ Mosh].
 
   
  +
/set trigger.trigger.beep.command "/print -beep;/exec -bg notify-send -i '/usr/share/icons/hicolor/32x32/apps/weechat.png' 'IRC Notification' "${tg_tag_nick}: ${tg_message_nocolor}""
=== Slack IRC ゲートウェイ ===
 
   
  +
=== モバイルデバイスへの通知 ===
[https://slack.com/ Slack] is a platform for team communication, a IRC on steroïd. Thanks to its open API, it is possible to connect to your slack team using weechat.
 
   
  +
メンションやプライベートメッセージの通知を Android モバイルデバイスで受信するには、[https://www.weechat.org/files/scripts/irssinotifier.py 公式サイト] から WeeChat に [https://irssinotifier.appspot.com/ IrssiNotifier] ポートを接続してください。このスクリプトには Google アカウントと、API キーを取得するためのサービスプロバイダへの登録ステップが必要です。プラグインをインストールします
Once weechat is running, all you have to is add a new server this way:
 
   
  +
$ cd ~/.local/share/weechat/python
{{ic|<nowiki>/server add NAME HOST/6667 -autoconnect -ssl -ssl_dhkey_size=512 -password=PASSWORD -username=USERNAME -nicks=NICK</nowiki>}}
 
  +
$ curl -O <nowiki>https://www.weechat.org/files/scripts/irssinotifier.py</nowiki>
  +
$ ln -s ../irssinotifier.py autoload/
   
  +
WeeChat で API トークンとエンドツーエンド暗号化パスワードを初期化します
where:
 
   
  +
/set plugins.var.python.irssinotifier.api_token your-api-token-from-website
* '''NAME''' is the name you want to give to the server
 
  +
/set plugins.var.python.irssinotifier.encryption_password your-password-same-as-in-andoid-app
* '''HOST''' is the the Host as provided on the Gateways page of your slack team
 
  +
/save
* '''PASSWORD''' is the Pass as provided on the Gateways page of your slack team
 
* '''USERNAME''' is the User as provided on the Gateways page of your slack team
 
* '''NICK''' is your Slack username.
 
   
  +
Google アカウントを必要としない代替手段として、[https://github.com/jamtur01/nma-weechat GitHub] にある [https://www.notifymyandroid.com NotifyMyAndroid.com] 用の Ruby スクリプトがあります。上記と同様の手順で、{{ic|~/.local/weechat/ruby}} にインストールしてください。
==== ファイルのアップロード ====
 
   
  +
=== systemd ユーザーサービスを使用した WeeChat リレー ===
To upload a file, run this following command from your shell :
 
   
  +
WeeChat インスタンスを他の WeeChat クライアントの WeeChat リレーとして使用するには (IRC リレー機能と混同しないでください)、必要に応じて、WeeChat リレープラグインと [[Systemd/ユーザー|systemd/ユーザーサービス]] のいずれかを使用できます。ヘッドレス操作、または systemd ユーザーサービスと [[tmux]] を組み合わせて完全なコマンドライン機能を維持します。
{{ic|<nowiki>curl -F file=@/path/to/file -F channels=CHAN -F token=XXX https://slack.com/api/files.upload</nowiki>}}
 
  +
  +
どちらの方法でも、ディレクトリ {{ic|~/.config/systemd/user/}} にサービスファイルを作成する必要があります。
  +
  +
==== tmux メソッド ====
  +
  +
systemd のジョブ管理方法と tmux のクライアントサーバ動作には非互換性があるため、{{ic|-L}} オプションを使ってデフォルトの tmux セッションと systemd が管理する WeeChat セッションを分離してください。これがデフォルトソケットを使った最初の tmux セッションである場合、WeeChat ユーザサービスを停止して再起動すると、デフォルト tmux ソケットに接続されている全てのセッションが停止します。WeeChat tmux セッションが他のデフォルト tmux セッションの後に開始された場合、systemd が次のサービスユニットに移行すると WeeChat セッションは終了します。WeeChat tmux サーバを独自のソケットに隔離することで、[[systemctl]] を起動した際に期待通りの動作をします。ただし、{{ic|-L}} を使って正しいソケットを選択しないと、tmux を使う際に WeeChat セッションが表示されないことを意味します。
  +
  +
{{hc|~/.config/systemd/user/weechat.service|2=
  +
[Unit]
  +
Description=A WeeChat client and relay service using Tmux
  +
After=network.target
  +
  +
[Service]
  +
Type=forking
  +
RemainAfterExit=yes
  +
ExecStart=/usr/bin/tmux -L weechat new -d -s weechat weechat
  +
ExecStop=/usr/bin/tmux -L weechat kill-session -t weechat
  +
  +
[Install]
  +
WantedBy=default.target
  +
}}
  +
  +
サービスが配置されたら、ユーザーユニットを [[起動/有効化]] して {{ic|loginctl enable-linger}} を実行するだけです。
  +
  +
そこから tmux セッションに接続して、weechat リレープラグインを設定できます:
  +
  +
$ tmux -L weechat attach
  +
  +
そこから、コンソール上で希望の設定を使用して WeeChat リレープラグインを設定できます: https://www.weechat.org/files/doc/stable/weechat_user.en.html#relay_plugin
  +
  +
tmux ステータスバーを非表示にしたい場合は、このオプションを {{ic|ExecStart}} に追加できます:
  +
\; set-option status off
  +
  +
セッションで 256 色を表示するには、これを tmux 設定ファイルに追加する必要がある場合があります:
  +
set -g default-terminal screen-256color
  +
  +
==== ヘッドレス方式 ====
  +
  +
この方法の主な違いは、WeeChat を普通に起動し、リレープラグインを設定し、WeeChat を停止してからサービスを起動するか、WeeChat が起動していない状態で手動で {{ic|relay.conf}} ファイルを編集してからサービスを起動する必要があるということです。いずれにせよ、''systemd'' WeeChat サービスを開始する前にリレー設定を行う必要があります: https://www.weechat.org/files/doc/stable/weechat_user.en.html#relay_plugin
  +
  +
{{hc|~/.config/systemd/user/weechat-headless.service|2=
  +
[Unit]
  +
Description=A headless WeeChat client and relay service
  +
After=network.target
  +
  +
[Service]
  +
Type=forking
  +
ExecStart=/usr/bin/weechat-headless --daemon
  +
  +
[Install]
  +
WantedBy=default.target
  +
}}
   
  +
''systemd'' が自動的に PID を追跡し、適切なシャットダウン信号をデーモンに送信するため、{{ic|ExecStop}} を定義する必要がないことに注意してください。
where:
 
   
  +
ユーザーユニットを配置したら、それを [[有効化]] します。ヘッドレスリレーを開始する準備ができたら、ユーザーユニットを [[起動]] します。
* '''CHAN''' is the channel ID as provided on the Gateways page of your slack team
 
* '''XXX''' is the team token as provided on the Gateways page of your slack team
 
   
 
== トラブルシューティング ==
 
== トラブルシューティング ==
191行目: 249行目:
 
=== プラグインのロードエラー ===
 
=== プラグインのロードエラー ===
   
  +
'''weechat''' を開始すると、メイン ウィンドウに次のような出力が表示される場合があります:
You may see output like the following in the main window after starting '''weechat''':
 
   
12:29:37 =!= | Error: unable to load plugin "/usr/lib/weechat/plugins/'''tcl.so'''": libtcl8.6.so: cannot open shared object file: No such file or directory
+
{{bc|<nowiki>13:26:10 =!= | Error: unable to load plugin "/usr/lib/weechat/plugins/ruby.so": libruby.so.2.4: cannot open shared object file: No such file or directory
12:29:37 =!= | If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)
+
13:26:10 =!= | If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)
12:29:37 =!= | Error: unable to load plugin "/usr/lib/weechat/plugins/'''ruby.so'''": libruby.so.2.0: cannot open shared object file: No such file or directory
+
13:26:10 =!= | Error: unable to load plugin "/usr/lib/weechat/plugins/lua.so": liblua.so.5.3: cannot open shared object file: No such file or directory
12:29:37 =!= | If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)
+
13:26:10 =!= | If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)
  +
13:26:10 =!= | Error: unable to load plugin "/usr/lib/weechat/plugins/aspell.so": libaspell.so.15: cannot open shared object file: No such file or directory
12:29:37 | Plugins loaded: alias, aspell, charset, fifo, guile, irc, logger, lua, perl, python, relay, rmodifier, script, xfer
 
  +
13:26:10 =!= | If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)
  +
13:26:10 =!= | Error: unable to load plugin "/usr/lib/weechat/plugins/tcl.so": libtcl8.6.so: cannot open shared object file: No such file or directory
  +
13:26:10 =!= | If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)</nowiki>|bc}}
   
  +
weechat のデフォルト設定では、{{ic|/usr/lib/weechat/plugins}} にあるすべてのプラグインをロードしようとします。この場合、ruby、lua、aspell、tcl が含まれます。これらのパッケージは weechat パッケージには必要ないため、マシンにインストールできない場合があります。これらのエラーが気になる場合は、次の 2 つのオプションがあります。
The default configuration for weechat attempts to load all plugins found in /usr/lib/weechat/plugins which in this case includes both tcl and ruby. These packages are not required by the weechat package and may not be installed on your machine. There are two options if these errors bother you:
 
   
# [[公式リポジトリ]]から {{Pkg|tcl}}, {{Pkg|ruby}} を[[インストール]]
+
# {{Pkg|ruby}}、{{Pkg|lua}}、{{Pkg|aspell}}、および/または {{Pkg|tcl}} を [[インストール]]
# Or, run {{ic|/set weechat.plugin.autoload "*,!tcl,!ruby"}} which will prevent loading those plugins with a bang (!) prefix.
+
# または、{{ic|/set weechat.plugin.autoload "*,!ruby,!lua,!aspell,!tcl"}} を実行すると、(!) プレフィックスが付いたプラグインがロードされなくなります。
   
  +
==== multiline.pl の読み込み中に問題が発生しました ====
== ヘルプの表示 ==
 
   
  +
この問題は、{{Pkg|perl}} バージョン 5.31.1 以上で発生します。
To access WeeChat's built-in help, simply type
 
   
  +
{{ic|multiline.pl}} スクリプトは、{{ic|Pod::Select}} モジュールに依存します。ただし、{{Pkg|perl}} バージョン v5.31.1 以降、{{ic|Pod::Select}} は削除されました。
/help
 
   
  +
この問題を解決するには、{{Pkg|perl-pod-parser}} をインストールします。
and the help will be displayed in the main buffer (usually buffer 1).
 
   
 
== 参照 ==
 
== 参照 ==
221行目: 282行目:
 
=== ガイド ===
 
=== ガイド ===
   
* [http://fixato.org/guides/setting_up_weechat.html FiXato's guide to WeeChat]
+
* [https://weechat.org/files/doc/stable/weechat_quickstart.en.html Official WeeChat quick start guide] - a good place to start
  +
* [https://guides.fixato.org/weechat FiXato's guide to WeeChat] - A Weechat Contributers Guide
* [http://pascalpoitras.com/2013/06/29/weechat-my-favorites-scripts/ Pascalpoitras: Favorite scripts]
 
  +
* [https://gist.github.com/pascalpoitras/8406501 My always up-to-date WeeChat configuration] - r3m (weechat-dev)
* [http://pascalpoitras.com/ Pascalpoitras Weechat Tips]
 
* [http://robots.thoughtbot.com/weechat-for-slacks-irc-gateway Thoughbot article on weechat and slack]
 

2023年11月16日 (木) 19:15時点における最新版

関連記事

WeeChat は高い拡張性を誇る機能豊富な IRC クライアントです。現在も活発に開発されています。

インストール

公式リポジトリから weechatインストールしてください。開発版は AURweechat-gitAUR でインストールできます。

実行

WeeChat は複数のインターフェイスを備えられるようになっています。weechat-[interface] を実行して WeeChat を起動してください。

現在のところ WeeChat には Ncurses インターフェイスしかありません。WeeChat の起動コマンドは:

$ weechat

設定

デフォルトでは、WeeChat は設定ファイルを XDG directory に保存します。WeeChat はいつでもファイルを書き込む可能性があるため、これらのファイルを直接編集することはお勧めできません。[1]

代わりに、/set コマンド を使用する必要があります。WeeChat バッファウィンドウで /set を実行すると、設定可能なすべてのオプションのリストを取得できます。デフォルトの設定可能なオプションは 600 近くあるため、ワイルドカード構文 (例として /set irc.server.* または /set *server*) を使用して検索できます。/help コマンドを使用すると、各オプションのヘルプを表示できます。

/help irc.server.libera.autoconnect
ヒント: すべての設定ファイルを単一のディレクトリに置きたい場合 (~/.weechat など)、このオプションを使用します: $ weechat -d $HOME/.weechat または環境変数 WEECHAT_HOME

サーバーに接続

IRC サーバーに接続するには、サーバーを追加してから /connect を使用します:

/server add libera irc.libera.chat/6697
/connect libera

詳細については、WeeChat のドキュメントと /help server を参照してください。

ノート: 事前にサーバーを追加せずに、/connect を使用した一時的なサーバー接続は許可されません。この機能を有効にするには、最初に /set irc.look.temporary_servers on を使用します。

SSL の設定

libera (#archlinux を含む) を含む多くの IRC サーバーは SSL をサポートしています。

/server でサーバーを作成している場合は、SSL ポート (通常は 6697) と -tls を行の最後に追加します。例えば:

/server add libera irc.libera.chat/6697 -tls
ノート: 一部のサーバーでは、ssl_dhkey_size の値をより低い値に変更する必要があります。たとえば、Libera を使用している場合は、コマンド /set irc.server.libera.tls_dhkey_size 1024 または /set irc.server.libera.tls_dhkey_size 1024 コマンドで値を設定する必要があります。(サーバーログを参照)

ヒントとテクニック‎

アップグレード

WeeChat は、IRC サーバーから切断せずにアップグレードできます (非 SSL 接続のみ):

/upgrade

これにより、新しい WeeChat バイナリがロードされ、現在の設定が再ロードされます。

エイリアス

エイリアスを作成して、一般的に実行されるコマンドを簡素化できます。良い例は、Wraithan の Smart Filter エイリアスです。

Smart Filter

まず、Smart Filter を有効にする必要があります。

/set irc.look.smart_filter "on"

次に、sfilter エイリアスを作成します。

/alias sfilter filter add irc_smart_$server_$channel irc.$server.$channel irc_smart_filter *

入力できるようになりました

/sfilter

任意のバッファにある場合、Smart Filter はそのバッファに対してのみ有効になります。

次のエイリアスは、現在のバッファーで以前に有効化された Smart Filter を削除する。エイリアスを追加します:

/alias rmsfilter filter del irc_smart_$server_$channel

実行

/rmsfilter

Exec コマンド

"exec" という新しいプラグインが追加され、コマンドは /exec です。外部コマンドを実行し、-o オプションを使用して現在のバッファに出力を表示することも、ローカル (デフォルト) で出力を表示することもできます。

キーバインド

参照 /help key

基本的な irssi スタイルのウィンドウスクロールを追加する例:

/key bind meta-p /window page_up
/key bind meta-n /window page_down

vimode プラグインを使用している場合、デフォルトのバインディングのほとんどは機能せず、vim のような代替手段が必要になります。バインディング を確認してください。

アイドル時に SSH の接続が切れる

SSH を使ってリモートシェルから WeeChat に接続している場合、例えば GNU Screentmux で WeeChat を実行している場合、アイドル状態でしばらくすると接続が切断されることがあります。この現象が発生する原因は複数ありますが、解決する最も簡単な方法はリモートシェル上の SSH 設定にこの設定を追加することで接続を強制的に維持することです。

これは WeeChat 自体とは関係ありませんが、アイドル時に接続が切断されることは代替の irssi ではデフォルトで起こりません。

# /etc/ssh/sshd_config
ClientAliveInterval 300

または、Mosh をご覧ください。

絵文字

絵文字はUnicodeセットの一部です。絵文字の要件:

  • ターミナルエミュレータはユニコードと絵文字サブセットをサポートしている必要があります。
  • ターミナルエミュレータで使用するフォントは、絵文字サブセットに対応している必要があります。

絵文字をサポートするターミナルの不完全なリスト:

マウスのサポート

ターミナルエミュレータはマウススクロールイベントを通過し、weechat は スクロールイン領域 を通過します。

  • チャットエリア
  • ニックネームリストバー

tmux 内のマウス

tmux で実行する場合は、~/.tmux.conf でマウスのサポートをオンにします。

set -g mouse on

Matrix

weechat-matrix スクリプトを使用すると、Matrix サーバーに接続できます。それをインストールしてから、次のようにします:

  1. Weechat 内で /script load weechat-matrix.py を実行してください、
  2. weechat-matrix を設定 します。
  3. Matrix チャンネルに参加するには、Matrix バッファ内で /join コマンドを使ってください。

WeeChat の起動時にスクリプトを自動的にロードするには、次のコマンドを実行します:

$ mkdir -p ~/.local/share/weechat/python/autoload
$ ln -s /usr/share/weechat/python/weechat-matrix.py -t ~/.local/share/weechat/python/autoload

Slack

Slack のネイティブクライアントがあります: wee-slack

デスクトップ通知

メンションまたはプライベートメッセージのデスクトップ通知を受信するには、Petr Zemek による weechat-notify-sendAUR スクリプトを インストール して下さい。

このスクリプトは libnotify を使用しており、KDE ​​と Gnome の両方で動作します。

組み込みの trigger プラグインを使用する別の方法は、trigger.trigger.beep.command の値を設定することです。

/set trigger.trigger.beep.command "/print -beep;/exec -bg notify-send -i '/usr/share/icons/hicolor/32x32/apps/weechat.png' 'IRC Notification' "${tg_tag_nick}: ${tg_message_nocolor}""

モバイルデバイスへの通知

メンションやプライベートメッセージの通知を Android モバイルデバイスで受信するには、公式サイト から WeeChat に IrssiNotifier ポートを接続してください。このスクリプトには Google アカウントと、API キーを取得するためのサービスプロバイダへの登録ステップが必要です。プラグインをインストールします

$ cd ~/.local/share/weechat/python
$ curl -O https://www.weechat.org/files/scripts/irssinotifier.py
$ ln -s ../irssinotifier.py autoload/

WeeChat で API トークンとエンドツーエンド暗号化パスワードを初期化します

/set plugins.var.python.irssinotifier.api_token your-api-token-from-website
/set plugins.var.python.irssinotifier.encryption_password your-password-same-as-in-andoid-app
/save

Google アカウントを必要としない代替手段として、GitHub にある NotifyMyAndroid.com 用の Ruby スクリプトがあります。上記と同様の手順で、~/.local/weechat/ruby にインストールしてください。

systemd ユーザーサービスを使用した WeeChat リレー

WeeChat インスタンスを他の WeeChat クライアントの WeeChat リレーとして使用するには (IRC リレー機能と混同しないでください)、必要に応じて、WeeChat リレープラグインと systemd/ユーザーサービス のいずれかを使用できます。ヘッドレス操作、または systemd ユーザーサービスと tmux を組み合わせて完全なコマンドライン機能を維持します。

どちらの方法でも、ディレクトリ ~/.config/systemd/user/ にサービスファイルを作成する必要があります。

tmux メソッド

systemd のジョブ管理方法と tmux のクライアントサーバ動作には非互換性があるため、-L オプションを使ってデフォルトの tmux セッションと systemd が管理する WeeChat セッションを分離してください。これがデフォルトソケットを使った最初の tmux セッションである場合、WeeChat ユーザサービスを停止して再起動すると、デフォルト tmux ソケットに接続されている全てのセッションが停止します。WeeChat tmux セッションが他のデフォルト tmux セッションの後に開始された場合、systemd が次のサービスユニットに移行すると WeeChat セッションは終了します。WeeChat tmux サーバを独自のソケットに隔離することで、systemctl を起動した際に期待通りの動作をします。ただし、-L を使って正しいソケットを選択しないと、tmux を使う際に WeeChat セッションが表示されないことを意味します。

~/.config/systemd/user/weechat.service
[Unit]
Description=A WeeChat client and relay service using Tmux
After=network.target

[Service]
Type=forking
RemainAfterExit=yes
ExecStart=/usr/bin/tmux -L weechat new -d -s weechat weechat
ExecStop=/usr/bin/tmux -L weechat kill-session -t weechat

[Install]
WantedBy=default.target

サービスが配置されたら、ユーザーユニットを 起動/有効化 して loginctl enable-linger を実行するだけです。

そこから tmux セッションに接続して、weechat リレープラグインを設定できます:

$ tmux -L weechat attach

そこから、コンソール上で希望の設定を使用して WeeChat リレープラグインを設定できます: https://www.weechat.org/files/doc/stable/weechat_user.en.html#relay_plugin

tmux ステータスバーを非表示にしたい場合は、このオプションを ExecStart に追加できます:

\; set-option status off

セッションで 256 色を表示するには、これを tmux 設定ファイルに追加する必要がある場合があります:

set -g default-terminal screen-256color

ヘッドレス方式

この方法の主な違いは、WeeChat を普通に起動し、リレープラグインを設定し、WeeChat を停止してからサービスを起動するか、WeeChat が起動していない状態で手動で relay.conf ファイルを編集してからサービスを起動する必要があるということです。いずれにせよ、systemd WeeChat サービスを開始する前にリレー設定を行う必要があります: https://www.weechat.org/files/doc/stable/weechat_user.en.html#relay_plugin

~/.config/systemd/user/weechat-headless.service
[Unit]
Description=A headless WeeChat client and relay service 
After=network.target

[Service]
Type=forking
ExecStart=/usr/bin/weechat-headless --daemon

[Install]
WantedBy=default.target

systemd が自動的に PID を追跡し、適切なシャットダウン信号をデーモンに送信するため、ExecStop を定義する必要がないことに注意してください。

ユーザーユニットを配置したら、それを 有効化 します。ヘッドレスリレーを開始する準備ができたら、ユーザーユニットを 起動 します。

トラブルシューティング

プラグインのロードエラー

weechat を開始すると、メイン ウィンドウに次のような出力が表示される場合があります:

13:26:10 =!= | Error: unable to load plugin "/usr/lib/weechat/plugins/ruby.so": libruby.so.2.4: cannot open shared object file: No such file or directory
13:26:10 =!= | If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)
13:26:10 =!= | Error: unable to load plugin "/usr/lib/weechat/plugins/lua.so": liblua.so.5.3: cannot open shared object file: No such file or directory
13:26:10 =!= | If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)
13:26:10 =!= | Error: unable to load plugin "/usr/lib/weechat/plugins/aspell.so": libaspell.so.15: cannot open shared object file: No such file or directory
13:26:10 =!= | If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)
13:26:10 =!= | Error: unable to load plugin "/usr/lib/weechat/plugins/tcl.so": libtcl8.6.so: cannot open shared object file: No such file or directory
13:26:10 =!= | If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)

weechat のデフォルト設定では、/usr/lib/weechat/plugins にあるすべてのプラグインをロードしようとします。この場合、ruby、lua、aspell、tcl が含まれます。これらのパッケージは weechat パッケージには必要ないため、マシンにインストールできない場合があります。これらのエラーが気になる場合は、次の 2 つのオプションがあります。

  1. rubyluaaspell、および/または tclインストール
  2. または、/set weechat.plugin.autoload "*,!ruby,!lua,!aspell,!tcl" を実行すると、(!) プレフィックスが付いたプラグインがロードされなくなります。

multiline.pl の読み込み中に問題が発生しました

この問題は、perl バージョン 5.31.1 以上で発生します。

multiline.pl スクリプトは、Pod::Select モジュールに依存します。ただし、perl バージョン v5.31.1 以降、Pod::Select は削除されました。

この問題を解決するには、perl-pod-parser をインストールします。

参照

ガイド