Created
October 30, 2018 21:26
-
-
Save premek/c207198795aac3e7b6da269dbd92cd5f 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 | |
# | |
# translates any selection and displays the result in a notification. | |
# Install: | |
# - sudo apt install libnotify-bin xsel jq | |
# - you can copy this file to ~/bin, /usr/local/bin or somewhere and make it executable | |
# - configure a hotkey to execute it. You can use xbindkeys or your DE settings | |
in=$(xsel -o | sed "s/[\"'<>]//g") | |
notify-send --icon=info "$in" "$(wget -U "Mozilla/5.0" -qO - "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&q=$in" |jq -r '.[0][0:]|.[]|.[1]')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment