LoginSignup
21
18

More than 5 years have passed since last update.

Yosemite上のtmuxからだとterminal-notifierがハングする際の解決法

Last updated at Posted at 2014-11-13

結論 :smile:

ハングする件 :smiling_imp:

https://github.com/alloy/terminal-notifier/issues/115 に書いてある通り、reattach-to-user-namespaceを入れて、以下の設定を.tmux.confに入れてやれば動く。

brew install reattach-to-user-namespace
tmux.conf
set-option -g default-command "reattach-to-user-namespace -l zsh"

reattach-to-user-namespaceはクリップボード共有のために入れているひとも多いはずだし、すでにこの設定は入ってると思う。

tmuxとzsh-notifyの相性が悪い件 :broken_heart:

mainstreamのzsh-notifyじゃなくて、 https://github.com/shrkw/zsh-notify/tree/tmux_support を使う。

ダメだった。まだ解決してない。 https://twitter.com/_atton/status/533034969224855552

ターミナルAppがカレントウィンドウかどうか、カレントタブかどうかのAppleScriptのところが正常に動いてないので直さないといけない。

git clone git@github.com:shrkw/zsh-notify.git
git checkout tmux-support

環境 :ship:

$ terminal-notifier -V
terminal-notifier (1.6.2) is a command-line tool to send OS X User Notifications.
$ tmux -V
tmux 1.9a
$ reattach-to-user-namespace -v
reattach-to-user-namespace version 2.3
    Supported OSes: OS X 10.5-10.10

経緯など :skull:

http://qiita.com/kei_s/items/96ee6929013f587b5878 を見まして、いっちょ通知の設定でもするかと気張ったけど、そもそもbrew install terminal-notifierで入れたterminal-notifierが動かない。

おかしいなあと思いつつtmuxの外から試すと動く。あれれと検索してみると、すぐに https://github.com/alloy/terminal-notifier/issues/106 が見つかった次第。

tmuxとzsh-notifyの相性が悪い件

素のzsh-notifyだとtmuxのことを考慮してなくてtmuxのウィンドウがフォアグラウンドにあっても通知がきてしまう。コマンド実行時のtmuxの#{window_id}を保存しといて、終わったときに現在のアクティブな#{window_id}と比較すればいいんじゃないかと思って雑な実装を一通り書き終わってPR作るかと思ったところで上記のブランチを見つけた。

けど、ちょっと中途半端な状態のブランチだったので、フォークしてターミナルAppで動くように数行加えた次第。

21
18
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
21
18