~mil/sxmo-tickets#377: 
Alarm clock script

It would be nice to have an alarm clock by default.

There exists a very basic user script: https://git.sr.ht/~anjan/sxmo-userscripts/tree/master/item/alarm.sh

It would be nice to have a slightly more convenient way to set up and modify an alarm. Perhaps using dmenu to set time and modify it? Problem is that the common functionality quickly becomes complex enough to warrant a small application.

I think it would be nice if it could:

  1. Set a time
  2. Stop the alarm
  3. Snooze
  4. Delete But possibly also:
  5. List alarms
  6. Modify
  7. Set a duration
  8. Alarm without a date (timer)
  9. ...
Status
REPORTED
Submitter
~murks
Assigned to
No-one
Submitted
3 months ago
Updated
20 hours ago
Labels
feature

~begs 3 months ago

It's Unix, you can just do sleep 12h && aplay /dev/urandom

~edp17 3 months ago

~lisael 20 hours ago

I gave a shot at this, here's my design:

  1. the alarm list is the crontab (no other disc writes)

  2. an alarm cron entry is of this form (<script> <action> <message> <uid>):

     25 7 * * 1-5 sxmo_rtcwake.sh /home/user/.local/bin/alarm.sh repeat 'Wake Up!' xesEsQRV
    
  3. alarm.sh has those subcommands:

  • ring <message>: ring the alarm, open a menu to either stop or snooze
  • once <message> <uid>: remove the cron entry (found by uid) and call ring
  • add <crontime> <message> <action ("once" or "repeat")>: add a cron task
  • list: list registered alarms
  • disable <uid>: disable an alarm (comment the line in the crontab)
  • enable <uid>: enable an alarm (uncomment in the crontab)
  • remove <uid>: remove the crontab entry
  • repeat <message> <uid>: ignore the uid and call ring <message> Targets the crontab tasks, the uid has no use in the command but identifies the line in the list for managment purpose (enable/disable/remove...)
  • snooze <message> <uid>: an alias of once, used to differenciate snozed alarm from user-set "once" alarms in the list
  1. set-alarm.sh UI script:
  • main menu is a list (mnc-ordered) of existing alarms (with a toggle icon to show enabled status) and a Add entry
  • Add asks for a time (HH:MM or crontab-style), once or repeat, and a message
  • choosing an alarm in the main menu opens an edit menu to enable/disable/remove/edit time or message)

I use working code implementing much of this design (I'm tweaking the Edit UI at the moment). It's probably not clean enough, but I may send a patch soon.

Register here or Log in to comment, or comment via email.