2011/12/13

開発版GNU Screenでマウスを使う

本記事は ターミナルマルチプレクサ Advent Calendar 2011 : ATND の14日目です。13日目は tmuxでマウスを使う でした。端末なのにマウスネタ、いいですね!それでは 11日目の記事 の続きとして開発版 GNU Screen でもサポートされるようになったマウスまわりの設定について紹介したいと思います。

開発版の GNU Screen でマウスまわりのサポートがあることについては以前まとめました。

あらためて ChangeLog を見ると次のようにありますが、具体的にどのような操作ができるかもう少し確認したいと思います。
'defmousetrack' and 'mousetrack', to turn on/off mouse-tracking for displays.
It's turned off by default. 
With mouse-tracking turned on, it's possible to switch to a region ('focus') using mouse clicks.
It's also possible to select a text region in copy-mode using a mouse click to place a mark and
the scroll wheel to scroll through the buffer. 
Additional features might be to allow clicking on window-titles in the caption to switch to that window.

まずは screen(1) を見てみましょう。

  • copy
    • Marking: The copy range is specified by setting two marks. The text between these marks will be highlighted. If mousetrack is set to on, marks can also be set using left mouse click.
  • defmousetrack [on|off]
    • Same as the mousetrack command except that the default setting for new windows is changed. Initial setting is off.
  • dispalys
    • The following keys can be used in displays list:
      • mouseclick Move to the selected line. Available when mousetrack is set to on.
  • mousetrack [on|off]
    • This command determines whether screen will watch for mouse clicks. When this command is enabled, regions that have been split in various ways can be selected by pointing to them with a mouse and left-clicking them. Without specifying on or off, the current state is displayed. The default state is determined by the defmousetrack command.
  • windowlist
    • mouseclick Move to the selected line. Available when mousetrack is set to on
ついでに info も。
* Mousetrack::                  Set whether screen should track mouse events.

5.2 Command Summary
===================
`defmousetrack ON|OFF'
     Select the default mouse tracking behavior.  *Note Mousetrack::.

`mousetrack [ON|OFF]'
     Enable selecting split regions with mouse clicks.  *Note
     Mousetrack::.

7.4 WindowList
==============
     `mouseclick' Move to the selected line. Available when
     `mousetrack' is set to `on'.

8.4.6 Displays
--------------
     `mouseclick' Move to the selected line. Available when
     `mousetrack' is set to `on'.

10.9 Mousetrack
===============
 
 -- Command: mousetrack [ `on|off' ]
     (none)
     This command determines whether `screen' will watch for mouse
     clicks. When this command is enabled, regions that have been split
     in various ways can be selected by pointing to them with a mouse
     and left-clicking them. Without specifying ON or OFF, the current
     state is displayed. The default state is determined by the
     `defmousetrack' command.
 
 -- Command: defmousetrack `on|off'
     (none)
     This command determines the default state of the `mousetrack'
     command, currently defaulting of OFF.

12.1.5 Marking
--------------
`mousetrack' is set to `on', marks can also be set using `left mouse click'.
当たり前ですが screen(1) と書かれている内容は同じですね。もう少し、こう裏技的なものを期待してましたが。。。

マウスで出来る操作は分かりました。けど私は端末作業でマウスを使うのは負けかなと思っていますので使う場面はほとんど無いだろうと考えていましたが、以外に使えそうな場面が見つかりました。

そう、iPad です。iSSH でのソフトウェアキーボードはさすがに使い辛いので、Ctrl-A :up などとはタイプしづらく、そのような場面においてはタッチするだけで操作ウィンドウを切り替えられることはとても素晴らしいです。iPad で GNU Screen するなら mousetrack は必須です!

おわりに

事前に告知していた記事がまとめきれず、急遽前日のエントリを見て書き起こしたので内容の無い記事でスミマセン。。。しかも人様のエントリネタに便乗して。。。github って手軽に試せるのでいいなと思いました。

0 件のコメント:

コメントを投稿