Skip to content

Instantly share code, notes, and snippets.

@sharpicx
Created February 8, 2023 07:44
Show Gist options
  • Save sharpicx/b283cc459b2311b02ebc0f568a884f54 to your computer and use it in GitHub Desktop.
Save sharpicx/b283cc459b2311b02ebc0f568a884f54 to your computer and use it in GitHub Desktop.
#!/bin/bash
# by sharpicx @ mycutestgirl.space - ayangnya rifda
# translating the selected sentence or word shown by dunstify daemon notification
# old func
# trans_fromEn() {
# translate-cli -f en -t id "$@" | awk -F: '{ print $2 }' | head -3 | tr '\n' ' ' | sed -s 's/[[:space:]]//'
# }
if [ "$(xsel -b)" == "" ]
then
dunstify "Translation" "clipboard is about blank to fill in"
else
dunstify "English -> Indonesian" "$(echo "$(xsel -b)" | translate -s en -t id)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment