The officially official Devuan Forum!

You are not logged in.

#1 2022-01-18 18:35:36

Ron
Member
Registered: 2018-04-22
Posts: 474  

Suggestions for a good simple alarm clock/timer

I used to use an app called Alarm-clock-applet, or something like that. It is not available in the Devuan 3 repos. Can anybody suggest something like it? I just want a simple timer to set that will ring/play an alarm alerting me that time's up. I usually use it when I set water to boil on the stove-top (one time I forgot and boiled away all the water, yikes).

On a related question, I see one potential replacement, gnome-clocks, however it needs avahi-daemon installed. On my list of "things to do" after a fresh OS install is to delete avahi-daemon. I don't have why, just delete it. Is there any reason why having this avahi-daemon is a bad idea? There must have been a reason why I wanted/needed it deleted.

Offline

#2 2022-01-18 22:57:32

Kelsoo
Member
Registered: 2016-12-09
Posts: 54  

Re: Suggestions for a good simple alarm clock/timer

sleep 300 ; mplayer loud-song.ogg

  works for me

Offline

#3 2022-01-19 02:17:10

Ron
Member
Registered: 2018-04-22
Posts: 474  

Re: Suggestions for a good simple alarm clock/timer

I assume this is a terminal command? What does "sleep" do? I don't want my computer to go to sleep.

Offline

#4 2022-01-19 10:05:42

xinomilo
Unknown
Registered: 2017-07-02
Posts: 315  

Re: Suggestions for a good simple alarm clock/timer

`sleep 300` means to delay running the following command (=mplayer...), for 300 seconds (= 5 mins.)
not suspend/hibernate the whole computer...

p.s. not using alarm clocks, so i don't have an alternative. still boil the water away occasionally big_smile

Offline

#5 2022-01-19 10:30:51

PedroReina
Member
From: Madrid, Spain
Registered: 2019-01-13
Posts: 267  
Website

Re: Suggestions for a good simple alarm clock/timer

Ron wrote:

I just want a simple timer

KTeaTime is in Devuan 3 repos: https://apps.kde.org/kteatime/

Offline

#6 2022-01-19 14:28:04

Kelsoo
Member
Registered: 2016-12-09
Posts: 54  

Re: Suggestions for a good simple alarm clock/timer

While sleep is fine and super easy to remember for boiling a kettle, it's not so good as an alarm. For that the "at" command is handy.

at -t ccyymmddhhmm.ss # cc=century yy=year  mm=month dd=day hh=hour mm=minute .ss=seconds (note the dot!) or just don't bother with .ss

Set the time to run

at -t 202201192359

press return

Command to run  e.g.   

ogg123 ~/Music/Rock/loud-song.ogg

press return
press ctrl D

That's it. see "man at" for more options like

Boil an egg

at now + 3 minutes

press "return"

ogg123 ~/path/to/loud-song.ogg

press "return" then press "ctrl D"

I believe  the return after ogg123 ~/path/to/loud-song.ogg is not strictly necessary but I've found it more intuitive and it doesn't hurt. In other words muscle memory. I keep doing it and it works fine! :-$

To switch off the alarm smile

killall ogg123

Morning alarm clock

at 7:30 AM tomorrow

press "return"

ogg123 ~/Music/Rock/loud-song.ogg

press "return" then press "ctrl D"

Note make sure your volume is up!

Offline

#7 2022-01-19 15:45:48

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: Suggestions for a good simple alarm clock/timer

Here's a (very) simple script for the timer (replace /path/to/sound/file with the actual full path to the sound file you want to use as the alert):

#!/bin/sh

echo "Hello $USER, please enter a countdown time
Add m for minutes and h for hours, seconds is assumed
For example 1h 1m 1 would set the time to 1 hour, 1 minute and 1 second"

read -r time

# shellcheck disable=2086 # word splitting is needed here
sleep $time

aplay /path/to/sound/file

^ Save that as timer then

chmod +x timer
sudo mv timer /usr/local/bin/

Then make a menu entry for it:

[Desktop Entry]
Type=Application
Name=Timer
Generic=Timer
Comment=HoaS' simple timer script
Exec=timer
Terminal=true
Categories=Utility;ConsoleOnly;
Keywords=utility;timer

^ Save that as timer.desktop then

sudo mkdir -p /usr/local/share/applications
sudo mv timer.desktop /usr/local/share/applications

Now log out and back in again and the "Timer" application should be available under "Utilities".

EDIT: the alsa-utils package supplies the aplay command so you'll need to install that along with any required CODECs for the sound file of choice.

Last edited by Head_on_a_Stick (2022-01-19 16:21:03)


Brianna Ghey — Rest In Power

Offline

#8 2022-01-19 18:09:35

Ron
Member
Registered: 2018-04-22
Posts: 474  

Re: Suggestions for a good simple alarm clock/timer

Thanks to all who answered. I have a question for using both Kelsoo's and HoaS's answer:

For Kelsoo's simple command: sleep 300 ; mplayer loud-song.ogg

is there a way to set it so that mplayer continues to play the sound file, until I tell it to stop?

For HoaS's script, same question.

Offline

#9 2022-01-19 18:24:51

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: Suggestions for a good simple alarm clock/timer

Both versions will play the sound file until it ends (or until the script/command is interrupted with <ctrl>+c).


Brianna Ghey — Rest In Power

Offline

#10 2022-01-19 18:56:26

Ron
Member
Registered: 2018-04-22
Posts: 474  

Re: Suggestions for a good simple alarm clock/timer

Head_on_a_Stick wrote:

Both versions will play the sound file until it ends (or until the script/command is interrupted with <ctrl>+c).

I'm sorry, I wasn't clear. What I want is for it to repeat the sound file until I tell it to stop repeating.

Offline

#11 2022-01-19 19:27:49

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: Suggestions for a good simple alarm clock/timer

In which case:

#!/bin/sh

echo "Hello $USER, please enter a countdown time
Add m for minutes and h for hours, seconds is assumed
For example 1h 1m 1 would set the time to 1 hour, 1 minute and 1 second"

read -r time

# shellcheck disable=2086 # word splitting is needed here
sleep $time

while aplay /path/to/sound/file ; do
   :
done

Or

sleep 300 ; while mplayer loud-song.ogg ; do : ; done

Last edited by Head_on_a_Stick (2022-01-19 19:30:25)


Brianna Ghey — Rest In Power

Offline

#12 2022-01-19 21:14:19

Ron
Member
Registered: 2018-04-22
Posts: 474  

Re: Suggestions for a good simple alarm clock/timer

Once again, HoaS for the win! Thanks.

Offline

#13 2022-01-19 21:57:06

xinomilo
Unknown
Registered: 2017-07-02
Posts: 315  

Re: Suggestions for a good simple alarm clock/timer

alternative (since mplayer supports it...) :

sleep 300 ; mplayer -loop 0 loud-song.ogg

Offline

#14 2022-01-20 11:27:48

Kelsoo
Member
Registered: 2016-12-09
Posts: 54  

Re: Suggestions for a good simple alarm clock/timer

^
In a similar fashion with ogg123 you can use the -Z option 

-Z, --random
Play files in pseudo-random order forever.

ogg123 -Z  ~/path/to/loud-song.ogg 

The obvious thing to note if using as an alarm is make sure you only have loud files in the directory.

Incidentally I was woken at 7;30 AM this morning with this blasting in my ears

https://derryth.com/s/free-software-song-best-version

Hence, I can recommend reading the man page at a sane time of day! If using the at command you can check the queue with

atq 

and clear items in it with atrm queue number

atrm 1 2 4 8

:-)

Offline

Board footer