Answer the question
In order to leave comments, you need to log in
How to change a script running in Kubuntu to work in Ubuntu 18.04?
I found an excellent utility for translating selected text in the window of any program - translate-shell and an excellent article ( poke ) on its use, but .. The script given in the article only works for KDE - displays the result in kdialog.
Ubuntu uses notify-send for popups, as I found out from another article ( poke ), which uses a similar method, but without translate-shell.
I would like to use translate-shell to the fullest and see the message in the popup (highlighted text + translation) and convert the script for Ubuntu and notify-send.
Script for KDE:
# #!/usr/bin/env bash
a=`xsel -o | trans :ru -no-ansi -b -l`
echo -e "$a" > /tmp/kdetrans
kdialog --title 'Перевод' --passivepopup "`cat /tmp/kdetrans`"
Answer the question
In order to leave comments, you need to log in
Dancing with a tambourine COULD!!!
Won this case.
There was no voice acting. stupidly copied and pasted and did not pay attention to the keys - the key
-sp(source, play) voices the original language.
#!/usr/bin/env bash
text="$(xsel -o)" # Переводимый текст
translate="$(xsel -o | trans :ru -no-ansi -sp -b)" # Результат с произношением оригинала (ключь -sp)
# echo "$translate" | xclip -selection clipboard
notify-send --icon=info "$text" "$translate" # Вызов popup с нужными данными
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question