about summary refs log tree commit diff
path: root/nixos/scripts/dm-spellcheck
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/scripts/dm-spellcheck')
-rwxr-xr-xnixos/scripts/dm-spellcheck38
1 files changed, 38 insertions, 0 deletions
diff --git a/nixos/scripts/dm-spellcheck b/nixos/scripts/dm-spellcheck
new file mode 100755
index 0000000..9626438
--- /dev/null
+++ b/nixos/scripts/dm-spellcheck
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+#
+# Script name: dm-dictionary
+# Description: Uses didyoumean as a spellchecker.
+# Dependencies: dmenu, fzf, rofi, didyoumean
+# GitLab: https://www.gitlab.com/dwt1/dmscripts
+# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE
+# Contributors: Francesco Prem Solidoro
+#               Derek Taylor
+
+# Set with the flags "-e", "-u","-o pipefail" cause the script to fail
+# if certain things happen, which is a good thing.  Otherwise, we can
+# get hidden bugs that are hard to discover.
+set -euo pipefail
+
+# shellcheck disable=SC1091
+source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null
+
+source_dmscripts_configs
+
+if configs_are_different; then
+    echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE"
+    sleep 1
+fi
+
+main() {
+    WORD="$(printf '%s' "" | ${MENU} "Enter Word:")"
+
+    if ! [ "${WORD}" ] || [ "${WORD}" = "quit" ]; then
+        printf 'No word inserted\n' >&2
+        exit 0
+    fi
+
+    dym -c "$WORD" | ${MENU} "Select Correct Spelling:" | xclip -selection clipboard
+}
+
+MENU="$(get_menu_program "$@")"
+[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main