{ lib, config, pkgs, ... }: { config = lib.mkIf (config.homecfg.make.gui) { # home.packages = with pkgs; [ # custom.vosk # custom.vosk.cli # custom.vosk.lang.en # custom.vosk.lang.ja # custom.vosk.lang.de # custom.vosk.lang.ru # jq # (python3.withPackages (ps: with ps; [ translatepy ])) # ]; # xdg.configFile."script/transcript-translate.py".text = '' # #!/bin/python # import sys; # from translatepy.translators.google import GoogleTranslate; # if len(sys.argv) != 2: # print("No language provided.") # exit # translator = GoogleTranslate() # while True: # for line in sys.stdin: # sys.stdout.write(translator.translate(line,sys.argv[1]).result+"\n") # ''; # xdg.configFile."script/transcript.sh".text = '' # #!/bin/sh # MODELS=( # "English:${pkgs.custom.vosklang.en-us}/usr/share/vosk-models/en-us" # "German:${pkgs.custom.vosklang.de}/usr/share/vosk-models/de" # "Russian:${pkgs.custom.vosklang.ru}/usr/share/vosk-models/ru" # "Japanese:${pkgs.custom.vosklang.ja}/usr/share/vosk-models/ja" # ) # MODEL_OPTS="" # for pair in "''${MODELS[@]}"; do # MODEL_OPTS+="$pair\n" # done # MODEL_OPT=$(echo -e "$MODEL_OPTS" | wofi --dmenu -p "Choose model:") # MODEL=$(echo "$MODEL_OPT" | awk -F ':' '{print $2}') # TRANSS="None\nNone-prog\nEnglish\nGerman\nRussian\nJapanese" # TRANS=$(echo -e "$TRANSS" | wofi --dmenu -p "Choose translation:") # export VOSK_MODEL=$MODEL # case $TRANS in # "None") # voskcli 2>/dev/null | jq --unbuffered -r '.alternatives[0].text // empty | select(length > 0)' 2>/dev/null # ;; # "None-prog") # voskcli 2>/dev/null | jq --unbuffered -r '.alternatives[0].text // empty, .partial // empty | select(length > 0)' 2>/dev/null # ;; # *) # voskcli 2>/dev/null | jq --unbuffered -r '.alternatives[0].text // empty | select(length > 0)' | python ~/.config/script/transcript-translate.py $TRANS # ;; # esac # ''; }; }