Skip to content

Commit 2bbea20

Browse files
committed
small delay
1 parent 46a7cdb commit 2bbea20

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

shelldio.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,9 @@ joker() {
302302
trap '{ clear; echo "Έξοδος..."; tput cnorm; exit 1; }' SIGINT
303303
clear
304304
joker_info
305-
sleep 0
306-
read -r -n1 -t1 input_play # Για μικρότερη αναμονή της read
305+
306+
# Use a different approach for reading input
307+
read -r -n1 -s input_play
307308

308309
if [[ $input_play = "q" ]] || [[ $input_play = "Q" ]]; then
309310
clear
@@ -312,17 +313,21 @@ joker() {
312313
# Kill the current mpv process
313314
kill $mpv_pid 2>/dev/null
314315
exit 0
315-
elif [[ $input_play = "r" ]] || [[ $input_play = "R" ]]; then
316+
elif [[ $input_play = "n" ]] || [[ $input_play = "N" ]]; then
316317
# Kill current mpv process
317318
kill $mpv_pid 2>/dev/null
318319
wait $mpv_pid 2>/dev/null
319320

320321
# Select new random station
321322
station_number=$(( (RANDOM % lines) + 1 ))
323+
clear
322324
echo "Επιλογή νέου τυχαίου σταθμού..."
323325
sleep 1
324326
break # Break out of inner loop to start new station
325327
fi
328+
329+
# Small delay to prevent excessive CPU usage
330+
sleep 0.1
326331
done
327332
done
328333
}

0 commit comments

Comments
 (0)