suckless_dictpopup/dictpopup
2023-08-05 18:58:09 -04:00

13 lines
358 B
Bash
Executable file

#!/bin/sh
word=${1:-$(sselp)}
word_without_spaces=$(echo "$word" | tr -d ' ')
dict_lookup=$(sdcv -n --utf8-output -e "$word_without_spaces")
if echo "$dict_lookup" | perl -0777 -ne 'exit 0 if /Nothing similar to/; exit 1'; then
echo "$dict_lookup" | popup
else
echo "$dict_lookup" | perl -0777 -pe 's/^.*\n.*\n.*\n.*\n//; s/<[^>]*>//g' | popup
fi