tmuxの「制御モード」とは何ですか?

tmuxの「制御モード」とは何ですか?

以下で起動オプションを確認してくださいman tmux

-C:制御モードで起動します(制御モードのセクションを参照)。 (-CC)を2回指定するとエコーはディセーブルになります。

その後、制御モードセクションにはman tmux次の説明があります。

CONTROL MODE
     tmux offers a textual interface called control mode.  This allows
     applications to communicate with tmux using a simple text-only protocol.

     In control mode, a client sends tmux commands or command sequences
     terminated by newlines on standard input.  Each command will produce one
     block of output on standard output.  An output block consists of a %begin
     line followed by the output (which may be empty).  The output block ends
     with a %end or %error.  %begin and matching %end or %error have two
     arguments: an integer time (as seconds from epoch) and command number.
     For example:

           %begin 1363006971 2
           0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
           %end 1363006971 2

     The refresh-client -C command may be used to set the size of a client in
     control mode.

     In control mode, tmux outputs notifications.  A notification will never
     occur inside an output block.

これが何を意味するのかはわかりませんが、少なくともいくつかのコマンドを試してtmux -CC()を介してどのように見え、感じられるかを確認しようとすると、それを起動するのと同じように見えますtmux new-session

では、「制御モード」とは何であり、通常モードとどう違いますか?


編集する

-CCコントロールモード()で開始されたセッションとウィンドウは、tmuxコマンドのキーボードショートカット(ウィンドウ分割など)に反応しないことがわかりました。では、そもそもコントロールモードを使用するのはなぜですか?

ベストアンサー1

私はMacを使用しており、iTerm2を使用しています。私が知る限り、tmux統合機能を備えた唯一の端末エミュレータです。実行から開始するtmux -CCと、iTermはtmuxセッションを制御します。これは、通常どおりiTerm2を正常に使用できることを意味します(ウィンドウを垂直に分割するにはCMDD、水平に分割するにはCMD-SHIFT-D)。代わりに、マウスを使用してウィンドウの位置を変更できますC-b {。プレフィックスをまったく使用する必要はありません。ウィンドウでの作業中にコピーして貼り付けても問題ありません。

tl;dr 使用法を使用すると、tmux -CCtmux をサポートする端末で「デフォルトで」使用できます。これまでこれをサポートするLinuxターミナルは見たことがなく、MacではiTerm2しか見えません。

おすすめ記事