diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2019-10-15 20:22:27 +0200 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2019-10-15 20:22:27 +0200 |
commit | 93e3958002b52ed2f7eb4ebc151efdd08e91dc21 (patch) | |
tree | 34ffc9c82a43cc8bb7718f60554d9054cc10817c /dmenuDic.sh | |
parent | 871b1c512d0c30a0460d1e3ad80636661877513c (diff) | |
download | scripts-93e3958002b52ed2f7eb4ebc151efdd08e91dc21.tar.gz scripts-93e3958002b52ed2f7eb4ebc151efdd08e91dc21.zip |
dmenuDic.sh depends now on environment variables instead of explicit file paths.
Diffstat (limited to 'dmenuDic.sh')
-rwxr-xr-x | dmenuDic.sh | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/dmenuDic.sh b/dmenuDic.sh index d1ef0f8..7c67fe6 100755 --- a/dmenuDic.sh +++ b/dmenuDic.sh @@ -2,13 +2,22 @@ # Selects a word from a dictionary with the help of dmenu and copies it to clipboard. +dicES="$CONFIG_DIC_ES" +dicEN="$CONFIG_DIC_EN" +dicPL="$CONFIG_DIC_PL" +lines=10 dict="$(printf "EN\nES\nPL" | dmenu -i -p "Choose a dictionary:")" +if [ "$dict" = "ES" ]; then + [ ! -f "$dicES" ] && dunstify "ES dic file ($dicES) does not exist." && exit 0 + word="$(dmenu -i -l $lines -p "Elige una palabra:" < "$dicES" )" +fi if [ "$dict" = "EN" ]; then - word="$(dmenu -i -l 10 -p "Choose a word:" < /usr/share/dict/words.txt)" -elif [ "$dict" = "ES" ]; then - word="$(dmenu -i -l 10 -p "Elige una palabra:" < /usr/share/dict/palabras.txt)" -elif [ "$dict" = "PL" ]; then - word="$(dmenu -i -l 10 -p "Wybierz słowo:" < /usr/share/dict/słowa.txt)" + [ ! -f "$dicEN" ] && dunstify "EN dic file ($dicEN) does not exist." && exit 0 + word="$(dmenu -i -l $lines -p "Choose a word:" < "$dicEN")" +fi +if [ "$dict" = "PL" ]; then + [ ! -f "$dicPL" ] && dunstify "PL dic file ($dicPL) does not exist." && exit 0 + word="$(dmenu -i -l $lines -p "Wybierz słowo:" < "$dicPL")" fi [ "$word" ] || exit 0 echo "$word" | tr -d '\n' | xsel -bi |