-
-
Save mortymacs/52886926cd197572011d648661277d82 to your computer and use it in GitHub Desktop.
Irssi and tmux-notify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| use vars qw($VERSION %IRSSI); | |
| use Irssi; | |
| # Script info | |
| $VERSION = '0.1'; | |
| %IRSSI = ( | |
| authors => 'Bas Stottelaar', | |
| contact => '[email protected]', | |
| name => 'tmux-notify', | |
| description => 'Notify tmux of IRC activity', | |
| license => 'MIT', | |
| ); | |
| # Handlers | |
| sub sig_notify | |
| { | |
| system('/usr/local/bin/tmux-notify'); | |
| } | |
| # Register handlers | |
| Irssi::signal_add('message public', \&sig_notify); | |
| Irssi::signal_add('message private', \&sig_notify); | |
| Irssi::signal_add('message invite', \&sig_notify); | |
| Irssi::signal_add('message kick', \&sig_notify); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Run only in tmux | |
| if [ "$TMUX_PANE" == "" ] | |
| then | |
| exit 0 | |
| fi | |
| # Retrieve information about tmux | |
| WINDOW=`/usr/bin/tmux display -pt $TMUX_PANE '#S:#I' 2> /dev/null` | |
| IS_WINDOW_ACTIVE=`/usr/bin/tmux display -pt $TMUX_PANE '#{window_active}' 2> /dev/null` | |
| if [ "$IS_WINDOW_ACTIVE" == "0" ] && [ "$WINDOW" != "" ] | |
| then | |
| # Enable visual activity | |
| /usr/bin/tmux set-window-option -t $WINDOW monitor-activity on > /dev/null | |
| # Print nothing, but this triggers the activity monitor. Requires bash to not fuck up the output. | |
| echo -ne "\0" | |
| # Alternative, but not tested | |
| # /usr/bin/tmux send-keys -t $WINDOW Space C-H | |
| # Disable visual activity again | |
| /usr/bin/tmux set-window-option -t $WINDOW monitor-activity off > /dev/null | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try these steps:
tmux-notify.shto/usr/local/bin/:mv tmux-notify.sh /usr/local/bin/tmux-notifychmod +x /usr/local/bin/tmux-notifymkdir -p ~/.irssi/scripts/autorun/mv tmux-notify.pl ~/.irssi/scripts/ln -s ~/.irssi/scripts/tmux-notify.pl ~/.irssi/scripts/autorun/To make sure that your this script loaded, run this command on irssi:
/script listirssi faq: https://irssi.org/documentation/faq/