Created
May 5, 2014 19:59
-
-
Save azat/a3067998f77b58afad5d to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# | |
# Translate with google-translate into X server OR tmux | |
# Bind it to shortcut | |
# | |
# @link http://habrahabr.ru/blogs/linux/137215/ | |
# | |
if [ -z $TMUX ]; then | |
notify-send -u critical "$(xsel -o)" "$(wget -U "Mozilla/5.0" -qO - "http://translate.google.com/translate_a/t?client=t&text=$(xsel -o | sed "s/[\"'<>]//g")&sl=auto&tl=ru" | sed 's/\[\[\[\"//' | cut -d \" -f 1)" | |
else | |
tmux display-message "$(wget -U "Mozilla/5.0" -qO - "http://translate.google.com/translate_a/t?client=t&text=$*&sl=auto&tl=ru" | sed 's/\[\[\[\"//' | cut -d \" -f 1)" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment