From 8f00ba299de3f194e7b6033b1fe6002ea13af044 Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Thu, 2 Jan 2025 13:36:21 -0600 Subject: [PATCH] add anki and expand some tools --- builds/utils/anki-advance-conjugation | 55 +++++++++++++++++++++++++++ builds/utils/dmenu-special | 4 ++ config/copernicus.nix | 1 + config/sxhkd/sxhkdrc | 4 ++ 4 files changed, 64 insertions(+) create mode 100755 builds/utils/anki-advance-conjugation diff --git a/builds/utils/anki-advance-conjugation b/builds/utils/anki-advance-conjugation new file mode 100755 index 0000000..c9a6ee3 --- /dev/null +++ b/builds/utils/anki-advance-conjugation @@ -0,0 +1,55 @@ +# when there's an open anki window, and we're entering conjugations for verbs +# or whatever, it's nice to automatically advance the conjugation form. + +# for instance, if your card key is: +# What is the yo form conjugation for ir in the imperfect? +# Your next one will naturally be +# What is the tú form conjugation for ir in the imperfect? + +sleep 0.25 + +# firstly, get the card key text +xdotool sleep 0.2 key ctrl+a ctrl+c + +sleep 0.25 + +# now the key is in our clipboard +text=$(xclip -out -selection clipboard) +form=$(echo "$text" | sed ' + s/.*\( yo \).*/\1/; + s/.*\( tú \).*/\1/; + s/.*\( él\/ella\/usted \).*/\1/; + s/.*\( nosotros \).*/\1/; + s/.*\( vosotros \).*/\1/; + s/.*\( ustedes \).*/\1/ +') + +case "$form" in + " yo ") + next="tú" + ;; + " tú ") + next="él/ella/usted" + ;; + " él/ella/usted ") + next="nosotros" + ;; + " nosotros ") + next="vosotros" + ;; + " vosotros ") + next="ustedes" + ;; + " ustedes ") + next="yo" + ;; +esac + +printf "text: %s\n" "$text" +printf "form: %s\n" "$form" +printf "next: %s\n" "$next" + +new_text=$(echo "$text" | sed "s|$form| $next |g") + +echo -n "$new_text" | xclip -in -selection clipboard +xdotool key ctrl+a ctrl+v diff --git a/builds/utils/dmenu-special b/builds/utils/dmenu-special index 3a7a172..eb775c5 100755 --- a/builds/utils/dmenu-special +++ b/builds/utils/dmenu-special @@ -10,6 +10,10 @@ dmenu <