-
Notifications
You must be signed in to change notification settings - Fork 0
/
d-dict
executable file
Β·78 lines (69 loc) Β· 2.58 KB
/
d-dict
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
# some cool dep :
# enchant --- spell check
# espeak-ng -- text-to-speech
word=$(echo "$(bat ~/.local/share/dict/hist ~/.local/share/dict/vocab | uniq)"| $menu -p 'ο Meaning for')
# echo "$word" >> /home/i/.local/share/dict/hist
# printf '\n%s\n' "$word" >> /home/i/.local/share/dict/hist
online () {
res=$(curl -s "https://api.dictionaryapi.dev/api/v2/entries/en_US/$word")
regex=$'"definition":"\K(.*?)(?=")'
definitions=$(echo $res | grep -Po "$regex")
separatedDefinition=$(sed ':a;N;$!ba;s/\n/\n\n/g' <<< "$definitions")
notify-send -t 15000 "$word" "$separatedDefinition"
}
offlinewn () {
output=$( sdcv -n0u wn $word )
notify-send -t 15000 "$word" "$output"
sdcv -n0u wn $word | rofi -dmenu -i -theme-str 'window {height:50%; width:50%;}'
}
offlineco () {
output=$( sdcv -n0u collins $word )
notify-send -t 15000 "$word" "$output"
sdcv -n0u collins $word | rofi -dmenu -i -theme-str 'window {height:50%; width:50%;}'
}
offlinedd () {
output=$( sdcv -n0u dictd $word )
notify-send -t 15000 "$word" "$output"
sdcv -n0u dictd $word | rofi -dmenu -i -theme-str 'window {height:50%; width:50%;}'
}
offlinejp () {
output=$( sdcv -n0u enjp $word )
notify-send -t 15000 "$word" "$output"
sdcv -n0u enjp $word | rofi -dmenu -i -theme-str 'window {height:50%; width:50%;}'
}
offlinesl () {
output=$( sdcv -n0u Collin $word )
notify-send -t 15000 "$word" "$output"
sdcv -n0u Collin $word | rofi -dmenu -i -theme-str 'window {height:50%; width:50%;}'
}
offlinefr () {
output=$( sdcv -n0u enfr $word )
notify-send -t 15000 "$word" "$output"
sdcv -n0u enfr $word | rofi -dmenu -i -theme-str 'window {height:50%; width:50%;}'
}
offlinesp () {
output=$( sdcv -n0u ensp $word )
notify-send -t 15000 "$word" "$output"
sdcv -n0u ensp $word | rofi -dmenu -i -theme-str 'window {height:50%; width:50%;}'
}
a1="ο WordNet Dictionary"
a2="π Collins Dictionary"
a3="π General Dict"
a4="π Japanese Word Translate"
a5="π Simple Dictionary"
a6="π French Word Translate"
a7="π― Spanish Word Translate"
b1="ο« Search Online"
#chose=$(printf "π Offline dictionary\nπ Oxford\nπ Dict gcide\nπ japanese dict\nπ Online dictionary" | rofi -rofi -dmenu -i -theme-str 'window {height:50%; width:50%;}' -i -p 'π Choose your Thesaurus ' -theme-str 'window {width: 30%;height: 40%;}')
chose=$(printf "$a5\n$a1\n$a2\n$a3\n$a4\n$a6\n$a7\n$b1" | $menu -i -l 10 -p ' οΉ Choose Thesaurus ')
case $chose in
"$a1") offlinewn ;;
"$a2") offlineco ;;
"$a3") offlinedd ;;
"$b1") online ;;
"$a4") offlinejp ;;
"$a5") offlinesl ;;
"$a6") offlinefr ;;
"$a7") offlinesp ;;
esac