Linux: translate text via keyboard | rofi-dmenu

avatar
(Edited)

Hi community!

aulfxz.png

With the following script you can translate small sentences and words using a keyboard shortcut!

  • start via shortcut
  • or via Terminal
  • enter text
  • notification with translation
  • clipboard with translation

Y2iXpRRkNSnseh3NuL6KUBitJTXrc5JybnqMQ2ftHfmVF.gif

The following packages are needed

  • Menu: rofi, rofi-dmenu
  • Notifications: libnotify
  • Translation: translate-shell
  • Clipboard: xclip

Install dependencies

sudo pacman -S rofi rofi-dmenu libnotify translate-shell xclip

Install script

#!/bin/sh
# translates text from rofi prompt to clipboard and creates a notfication

notify-send -t 5000 "Translation" "$(trans -b "$(rofi -dmenu -p translate &)" | tr -d '\n' | xclip -sel clip -f)"

If you see something in the script that can be improved, feel free to write a comment :)



0
0
0.000
2 comments
avatar

Congratulations @sebov1c! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You distributed more than 50 upvotes. Your next target is to reach 100 upvotes.
You got more than 10 replies. Your next target is to reach 50 replies.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

Valentine's day challenge - Give a badge to your beloved!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
0
0
0.000