0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

terminalのショートカットを改良した話

0
Last updated at Posted at 2020-09-22

きっかけ

最近、Terminalをterminatorに切り替えた。デフォルトのCtrl + Alt + Tだと、一々新しいウィンドウが開いて邪魔くさい。オプション使って新しいタブで開くことは出来るが、画面分割で使うのでそれも微妙。
開いてないときだけ新たに開いて、既に開いている場合は最前面に持ってくるだけにしたかった。

実装

psからterminatorのプロセスIDを拾ってそれをwmctrlでウィンドウIDに変換してxdootoolで最前面に持ってくるだけ
アプリケーション閉じてもpsにはしばらく残るのでウィンドウidで判定させた。

pid=`ps -A | awk '$4=="terminator" {print $1}'`
wid=`wmctrl -lp | awk -v pid=$pid '$3==pid {print $1}'`

if [ "${wid}" = "" ]; then
    terminator
else
    xdotool windowactivate $wid
fi

これをカスタムショートカットでCtrl + Alt + Tに設定し直す。

おわり

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?