Updated sequence storm reader for Mac compatibility.

This commit is contained in:
Storm Dragon 2020-12-11 23:01:49 -05:00
parent 91741afa64
commit 858211865d

View File

@ -44,7 +44,7 @@ write_sequence_storm_reader() {
fi fi
# Here-document start # Here-document start
cat << "EOF" > ~/.SequenceStormReader cat << "EOF" > ~/.SequenceStormReader
#! /bin/bash #!/usr/bin/env bash
# Wait for the game to be launched # Wait for the game to be launched
while ! pgrep -u $USER ^SequenceStorm &> /dev/null ; do while ! pgrep -u $USER ^SequenceStorm &> /dev/null ; do
@ -54,16 +54,28 @@ done
export DISPLAY=:0 export DISPLAY=:0
unset cliptext unset cliptext
while pgrep -u $USER ^SequenceStorm &> /dev/null ; do while pgrep -u $USER ^SequenceStorm &> /dev/null ; do
if [[ "$(uname)" == "Darwin" ]]; then
tmp="$(pbpaste 2> /dev/null)"
else
tmp="$(xclip -selection clipboard -o 2> /dev/null)" tmp="$(xclip -selection clipboard -o 2> /dev/null)"
fi
tmp="${tmp//%/ percent }" tmp="${tmp//%/ percent }"
if [ "$tmp" != "$cliptext" ] ; then if [ "$tmp" != "$cliptext" ] ; then
cliptext="$tmp" cliptext="$tmp"
if [[ "${cliptext,,}" =~ key|load|private|says|terminal ]]; then if [[ "${cliptext,,}" =~ key|load|private|says|terminal ]]; then
if [[ "$(uname)" == "Darwin" ]]; then
say -v alex -r 300 "$cliptext"
else
spd-say -w -r 50 -- "$cliptext" spd-say -w -r 50 -- "$cliptext"
fi
else
if [[ "$(uname)" == "Darwin" ]]; then
say -v alex -r 300 "$cliptext"
else else
spd-say -r 50 -- "$cliptext" spd-say -r 50 -- "$cliptext"
fi fi
fi fi
fi
sleep 0.05 sleep 0.05
done done