AI created a countdown timer that has a memo feature.
AI created a countdown timer that has a memo feature. The way it works
is you create a timer.sh file and when you click it you get a pop-up
window that asks you to enter the number of minutes to wait before
playing a whistle sound (your own .mp3 file) and a short note relating
to what the timer is reminding you of, like "turn off stove"
---
#!/bin/bash
# Use zenity form to get both minutes and memo in one dialog form_output=$(zenity --forms --title="Set Timer" \
--text="Enter timer details:" \
--add-entry="Minutes to wait" \
--add-entry="Memo")
# If the user cancelled the form
if [[ $? -ne 0 ]]; then
exit 1
fi
# Split the form output into variables
minutes=$(echo "$form_output" | cut -d'|' -f1)
memo=$(echo "$form_output" | cut -d'|' -f2)
# Validate minutes input
if [[ -z "$minutes" || ! "$minutes" =~ ^[0-9]+$ ]]; then
zenity --error --text="Invalid input. Please enter a number of minutes."
exit 1
fi
# Wait for the specified number of minutes
sleep $(( minutes * 60 ))
# Play the MP3 in the background
mpg123 /home/~/Desktop/Sound/Steam.Whistle.mp3 &
MP3_PID=$!
# Show final alert with memo and STOP button
zenity --info \
--title="Alarm" \
--ok-label="STOP" \
--text="Time's up!\n\n$memo"
# Stop the audio
kill $MP3_PID 2>/dev/null
# Split the form output into variables
minutes=$(echo "$form_output" | cut -d'|' -f1)
memo=$(echo "$form_output" | cut -d'|' -f2)
# Play the MP3 in the background
mpg123 /home/~/Desktop/Sound/Steam.Whistle.mp3 &
MP3_PID=$!
There is error. It's not mpg123, must be mpg321. Not installed by
default. :)
On Sun, 11 May 2025 18:09:10 +0200, yossarian < wrote:
There is error. It's not mpg123, must be mpg321. Not installed by
default. :)
<https://packages.debian.org/bookworm/mpg123> <https://packages.debian.org/bookworm/mpg321>
Neither is, I think.
On Thu, 08 May 2025 11:11:32 -0300
"Dr. Noah Bodie" <noah@bodie.not> wrote:
# Play the MP3 in the background
mpg123 /home/~/Desktop/Sound/Steam.Whistle.mp3 &
MP3_PID=$!
There is error. It's not mpg123, must be mpg321. Not installed by
default. :)
yossarian < wrote:
"Dr. Noah Bodie" wrote:
# Play the MP3 in the background
mpg123 /home/~/Desktop/Sound/Steam.Whistle.mp3 &
MP3_PID=$!
There is error. It's not mpg123, must be mpg321. Not installed by
default. :)
https://www.mpg123.de
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,064 |
Nodes: | 10 (0 / 10) |
Uptime: | 148:16:59 |
Calls: | 13,691 |
Calls today: | 1 |
Files: | 186,936 |
D/L today: |
33 files (6,120K bytes) |
Messages: | 2,410,934 |