Commit e28b3a1
xxwhirlpool
·
2026-05-21 16:35:22 -0400 EDT
parent 9fab2bb
dmenu scripts
2 files changed,
+34,
-7
+32,
-6
| ... | ... | @@ -4,11 +4,37 @@ | |
| 4 | 4 | # | |
| 5 | 5 | # https://github.com/BreadOnPenguins/scripts/blob/master/define_word | |
| 6 | 6 | ||
| 7 | - | word=$(echo " " | dmenu -i -c -l 10 -p "dictionary!") | |
| 7 | + | dict() { | |
| 8 | + | word=$(echo " " | dmenu -i -c -l 10 -p "dictionary!") | |
| 8 | 9 | ||
| 9 | - | if [[ -n "$word" ]]; then | |
| 10 | - | response=$(curl -s --connect-timeout 5 --max-time 10 "https://api.dictionaryapi.dev/api/v2/entries/en_US/$word") | |
| 11 | - | notif=$(echo "$response" | jq -r '[.[].meanings[] | {pos: .partOfSpeech, def: .definitions[].definition}] | .[:3].[] | "\n\(.pos). \(.def)"') | |
| 10 | + | if [[ -n "$word" ]]; then | |
| 11 | + | response=$(curl -s --connect-timeout 5 --max-time 10 "https://api.dictionaryapi.dev/api/v2/entries/en_US/$word") | |
| 12 | + | notif=$(echo "$response" | jq -r '[.[].meanings[] | {pos: .partOfSpeech, def: .definitions[].definition}] | .[:3].[] | "\n\(.pos). \(.def)"') | |
| 13 | + | notify-send -t 30000 "$word" "$notif" | |
| 14 | + | fi | |
| 15 | + | } | |
| 12 | 16 | ||
| 13 | - | notify-send -t 40000 "$word" "$notif" | |
| 14 | - | fi | |
| 17 | + | synonyms() { | |
| 18 | + | word=$(echo " " | dmenu -i -c -l 10 -p "get synonyms") | |
| 19 | + | ||
| 20 | + | if [[ -n "$word" ]]; then | |
| 21 | + | response=$(curl -s --connect-timeout 5 --max-time 10 "https://api.dictionaryapi.dev/api/v2/entries/en_US/$word") | |
| 22 | + | notif=$(echo "$response" | jq -r '.[].meanings[].synonyms.[]') | |
| 23 | + | ||
| 24 | + | if [[ "$notif" -eq 0 ]]; then | |
| 25 | + | notify-send -t 30000 "$word" "no synonyms found" | |
| 26 | + | else | |
| 27 | + | notify-send -t 30000 "$word" "$notif" | |
| 28 | + | fi | |
| 29 | + | fi | |
| 30 | + | } | |
| 31 | + | ||
| 32 | + | menu() { | |
| 33 | + | cmd=$(printf "dictionary\\nsynonyms" | dmenu -i -c -l 10 -p "words!") | |
| 34 | + | case "$cmd" in | |
| 35 | + | dictionary) dict;; | |
| 36 | + | synonyms) synonyms;; | |
| 37 | + | esac | |
| 38 | + | } | |
| 39 | + | ||
| 40 | + | menu |
| ... | ... | @@ -1,10 +1,11 @@ | |
| 1 | 1 | #!/usr/bin/env bash | |
| 2 | 2 | ||
| 3 | 3 | menu() { | |
| 4 | - | cmd=$(printf "ftp\\nterminal" | dmenu -i -c -l 10 -p "split tunnel windows") | |
| 4 | + | cmd=$(printf "ftp\\nterminal\\nslsk" | dmenu -i -c -l 10 -p "split tunnel windows") | |
| 5 | 5 | case "$cmd" in | |
| 6 | 6 | ftp) mvpn filezilla;; | |
| 7 | 7 | terminal) mvpn kitty;; | |
| 8 | + | slsk) mvpn "/home/kat/Downloads/Programs/slsk.sh";; | |
| 8 | 9 | esac | |
| 9 | 10 | } | |
| 10 | 11 |