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 @@
44 #
55 # https://github.com/BreadOnPenguins/scripts/blob/master/define_word
66
7-word=$(echo " " | dmenu -i -c -l 10 -p "dictionary!")
7+dict() {
8+ word=$(echo " " | dmenu -i -c -l 10 -p "dictionary!")
89
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+}
1216
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
+2, -1
......@@ -1,10 +1,11 @@
11 #!/usr/bin/env bash
22
33 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")
55 case "$cmd" in
66 ftp) mvpn filezilla;;
77 terminal) mvpn kitty;;
8+ slsk) mvpn "/home/kat/Downloads/Programs/slsk.sh";;
89 esac
910 }
1011