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