Created
February 17, 2013 02:13
-
-
Save thewtex/4969741 to your computer and use it in GitHub Desktop.
Script to send a tmux, desktop, and audio notification after the completion of the given command when using tmux.
This file contains 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 | |
# Send a tmux, desktop, and audio notification after the completion | |
# of the given command when using tmux. | |
# | |
# Requires: tmux | |
# Recommended: espeak, libnotify | |
tmux_window=$(/usr/bin/tmux list-windows \ | |
-F "#{window_active} #{window_index} #{window_name}" | \ | |
sort | tail -n 1 | cut -d ' ' -f 2-) | |
notification="$@ in ${tmux_window}" | |
"$@" | |
if test $? -eq 0; then | |
notification="${notification} succeeded" | |
else | |
notification="${notification} failed" | |
fi | |
/usr/bin/tmux display-message "${notification}" | |
if which notify-send &> /dev/null; then | |
notify-send "${notification}" | |
fi | |
if which espeak &> /dev/null; then | |
espeak "${notification}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment