Skip to content

Commit

Permalink
添加DEF/翻译脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
yaocccc committed Apr 7, 2023
1 parent 8900624 commit abcf40a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions DEF/translate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#! /bin/bash
# 利用chatgpt翻译选中的文本
# https://github.com/j178/chatgpt

msgid=$((RANDOM%1000))

notify-send -r $msgid "󰊿 AI translator" "."; sleep 0.3
notify-send -r $msgid "󰊿 AI translator" ".."; sleep 0.3
notify-send -r $msgid "󰊿 AI translator" "...";

r=""
chatgpt -p translator -n -d "$(xsel -o)" | while IFS= read -r -n1 char
do
r="$r$char"
notify-send -r $msgid "󰊿 AI translator" "$r"
done

0 comments on commit abcf40a

Please sign in to comment.