From 858211865d64e3ea58ef6e223eff9f7556503432 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 11 Dec 2020 23:01:49 -0500 Subject: [PATCH] Updated sequence storm reader for Mac compatibility. --- audiogame-manager.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index a15002d..93d185a 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -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