suckless_dictpopup/dictpopup

14 lines
377 B
Plaintext
Raw Permalink Normal View History

2023-05-09 10:42:03 +00:00
#!/bin/sh
2023-08-06 18:18:21 +00:00
2023-05-30 21:00:41 +00:00
word=${1:-$(sselp)}
2023-08-05 22:58:09 +00:00
word_without_spaces=$(echo "$word" | tr -d ' ')
2023-06-03 01:22:57 +00:00
2023-08-05 22:58:09 +00:00
dict_lookup=$(sdcv -n --utf8-output -e "$word_without_spaces")
2023-06-03 01:22:57 +00:00
2023-08-05 22:58:09 +00:00
if echo "$dict_lookup" | perl -0777 -ne 'exit 0 if /Nothing similar to/; exit 1'; then
echo "$dict_lookup" | popup
2023-06-03 01:22:57 +00:00
else
2023-08-06 18:18:21 +00:00
echo "$dict_lookup" | perl -0777 -pe 's/^.*\n.*\n.*\n.*\n//; s/<[^>]*>//g; s/(--->|-->)//g;' | popup
2023-06-03 01:22:57 +00:00
fi