/alarm

A shell script to play an alarm at a predetermined time

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Alarm

A shell script to play an alarm at a predetermined time. Optional feature for dwm-bar.

Features

  • Creates a temporary file so the current status can be used in other scripts (e.g. dwm-bar).
  • Alerts the user with a notification.
  • Prevents multiple instances of the script running at once.

Optional dependencies

  • libnotify for notifications
  • mpv to play alarm sound

Installation

  1. Clone the repository:
$ git clone https://github.com/joestandring/alarm
  1. Enter the directory:
$ cd alarm
  1. Allow running of the script:
$ chmod +x alarm.sh
  1. Optionally add it to a directory in the PATH:
$ sudo cp alarm.sh /bin/
  1. Run the script:
$ ./alarm.sh

Configuration

For an alarm sound to play, you must edit the "ALARMSOUND" variable in alarm.sh:

ALARMSOUND="/path/to/alarmsound.mp3"

How to use

You can run alarm.sh with 3 arguments corresponding to the time for the alarm to play (HH:MM:SS):

$ ./alarm.sh 14 30 0
Alarm set for 14:30:00

Alternatively, if you run the script with less than 3 arguments, you will be prompted for the hour, minute, and second:

$ ./alarm.sh
Hour: 1
Minute: 30
Second: 0

Alarm set for 14:30:00

If you want to stop the countdown, you can run

killall alarm.sh