From bd7ffca7774ac96abb496d86810b20dc20736178 Mon Sep 17 00:00:00 2001 From: subh Date: Sat, 31 Jan 2026 10:35:36 +0530 Subject: Added a script with a hotkey to lookup word meanings and a url decoder in python for the CLI --- scripts/define.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 scripts/define.sh (limited to 'scripts/define.sh') diff --git a/scripts/define.sh b/scripts/define.sh new file mode 100755 index 0000000..041f0a1 --- /dev/null +++ b/scripts/define.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "[!] Provide a word" + exit 1 +fi + +RESP=$(curl -s -q https://api.dictionaryapi.dev/api/v2/entries/en/$1 | jq -r ' + [.[0].meanings[] + | select(.partOfSpeech=="noun") + | .definitions[].definition][0:2] + | to_entries + | map("\(.key + 1). \(.value)") + | join("\n") +' 2>/dev/null) + +if [ -z "$RESP" ]; then + notify-send -t 10000 -u normal -i accessories-dictionary "Meaning Not Found!" +else + notify-send -t 10000 -u normal -i accessories-dictionary "$1" "$RESP" +fi + -- cgit v1.2.3