Linux: translate text via keyboard | rofi-dmenu

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 :)

H2
H3
H4
3 columns
2 columns
1 column
2 Comments
Ecency