Previously, tts.bash used to work but not its not working whereas ocr.bash didn’t worked from the start
Both script when executed in terminal works perfectly.
shortcut-export.kksrc
[Custom Commands][net.local.ocr.bash.desktop]
Exec=/home/beta/bin/ocr.bash
Name=ocr
[Custom Commands][net.local.tts.bash.desktop]
Exec=/home/beta/bin/tts.bash
Name=tts
[net.local.ocr.bash.desktop][Global Shortcuts]
_launch=Meta+X
[net.local.tts.bash.desktop][Global Shortcuts]
_launch=Meta+Z
ocr.bash
#/usr/bin/bash
notify-send hello
TMPFILE=$(mktemp)
trap 'rm -f "$TMPFILE"' EXIT
spectacle -r -o $TMPFILE -b -n 2>/dev/null
if [ -s "$TMPFILE" ]; then
tesseract $TMPFILE - | wl-copy
kdialog --passivepopup "OCR finished" 7 --title "OCR"
fi
tts.bash
#/usr/bin/bash
spd-say -w "$(wl-paste -p)"