Last active
May 16, 2023 11:47
-
-
Save sharpicx/c7c65787a3191800221c0df37c4f19d6 to your computer and use it in GitHub Desktop.
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
import subprocess | |
import mtranslate | |
import clipboard | |
def translateNow(argv, dest="id"): | |
return mtranslate.translate(argv, dest) | |
def main(): | |
text = translateNow(clipboard.paste()) | |
try: | |
if text == "": | |
subprocess.run("dunstify 'Translation' 'clipboard is bout to get heal, try again if it has a content'", shell=True) | |
else: | |
subprocess.run(f'dunstify "English -> Indonesian" "{text}"', shell=True) | |
except Exception as i: | |
subprocess.run(f'dunstify "Translation" "error"', shell=True) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment