Description
tenofy
is a Bash script that sets a desktop notification timer with a custom duration and message. It runs silently in the background and uses notify-send
to display a notification when the timer ends.
Key features
- Flexible duration format: accepts hours, minutes, and seconds (e.g.,
1h 10m 50s
). - Custom notification message when the timer expires.
- Interactive prompts if arguments are not provided.
- Lightweight and runs in the background so the terminal stays free.
- Built-in help option (
-h
/--help
).
Installation
- Save the script as
tenofy
. - Make it executable:
chmod +x tenofy
- (Optional) Move it to a folder in your
$PATH
:sudo mv tenofy /usr/local/bin/
-
Ensure
notify-send
is installed (part oflibnotify
on most Linux distributions):sudo apt install libnotify-bin # For Debian/Ubuntu
sudo dnf install libnotify # For Fedora
sudo pacman -S libnotify # For Arch
Usage
General format
tenofy -t <duration> -m <message>
Options
-t <duration>
: Timer duration usingh
,m
, and/ors
(e.g.,5m 30s
or1h 10m
).-m <message>
: Message to display when time is up.-h
,--help
: Show help message and exit.
If arguments are not provided, the script will ask for duration and message interactively.
Examples
- Run with full arguments
tenofy -t "1h 10m 50s" -m "This is the message"
- Quick 5-minute break timer
tenofy -t "5m" -m "Break time is over!"
- Interactive mode (no arguments, script will prompt)
tenofy
How it works
- The script parses
-t
and-m
arguments or prompts for them if missing. - It validates and formats the duration (ensures proper spacing between hours, minutes, seconds).
- The timer runs in a background subshell using
sleep
. - When the timer expires, it triggers a
notify-send
desktop notification with the specified message. - Meanwhile, the script immediately returns control to the terminal so you can continue working.
Input validation
- Both duration and message are required.
- Duration must include a valid time suffix (
h
,m
, ors
). - Invalid arguments display a usage guide.
License
Free to use, modify, and distribute.