first draft
This commit is contained in:
61
README.md
61
README.md
@@ -1,3 +1,60 @@
|
|||||||
# reminder
|
# Reminder Script
|
||||||
|
|
||||||
|
This script allows you to set reminders from the command line on a Linux system. It uses the `notify-send` command to display pop-up notifications and the `at` command to schedule these notifications at specified times.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Set reminders with custom messages.
|
||||||
|
- Schedule reminders for specific times or intervals.
|
||||||
|
- Display notifications as pop-ups on your desktop.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- `libnotify-bin` package for `notify-send` command.
|
||||||
|
- `at` command for scheduling tasks.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1. **Clone the Repository**:
|
||||||
|
Clone this repository to your local machine:
|
||||||
|
```bash
|
||||||
|
git clone <repository-url>
|
||||||
|
cd <repository-directory>
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Install Necessary Packages**:
|
||||||
|
Ensure you have the `libnotify-bin` package installed. For Fedora, you can install it using:
|
||||||
|
```bash
|
||||||
|
sudo dnf install libnotify
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Make the Script Executable**:
|
||||||
|
Make the script executable by running:
|
||||||
|
```bash
|
||||||
|
chmod +x remind.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
- **Set a Reminder**:
|
||||||
|
Use the script to set reminders with a message and time. For example:
|
||||||
|
```bash
|
||||||
|
./remind.sh "Time to take a break" in 5 minutes
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Set a Reminder for a Specific Time**:
|
||||||
|
```bash
|
||||||
|
./remind.sh "Meeting starts" at 14:00
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Immediate Reminder**:
|
||||||
|
```bash
|
||||||
|
./remind.sh "Check emails" now
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- Ensure your desktop environment's notification system is enabled.
|
||||||
|
- The `at` command must be running on your system to schedule tasks.
|
||||||
|
|
||||||
|
|
||||||
A simple script to set a reminder on Linux using libnotify
|
|
||||||
40
remind.sh
Executable file
40
remind.sh
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function remind() {
|
||||||
|
local COUNT="$#"
|
||||||
|
local COMMAND="$1"
|
||||||
|
local MESSAGE="$1"
|
||||||
|
local OP="$2"
|
||||||
|
shift 2
|
||||||
|
local WHEN="$@"
|
||||||
|
|
||||||
|
# Display help if no parameters or help command
|
||||||
|
if [[ $COUNT -eq 0 || "$COMMAND" == "help" || "$COMMAND" == "--help" || "$COMMAND" == "-h" ]]; then
|
||||||
|
echo "Usage: remind <message> <time>"
|
||||||
|
echo "Examples:"
|
||||||
|
echo ' remind "Hi there" now'
|
||||||
|
echo ' remind "Time to wake up" in 5 minutes'
|
||||||
|
echo ' remind "Dinner" in 1 hour'
|
||||||
|
echo ' remind "Take a break" at noon'
|
||||||
|
echo ' remind "Are you ready?" at 13:00'
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine time of notification
|
||||||
|
if [[ "$OP" == "in" ]]; then
|
||||||
|
local TIME="now + $WHEN"
|
||||||
|
elif [[ "$OP" == "at" ]]; then
|
||||||
|
local TIME="$WHEN"
|
||||||
|
elif [[ "$OP" == "now" ]]; then
|
||||||
|
local TIME="now"
|
||||||
|
else
|
||||||
|
echo "Invalid time operator $OP"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Schedule the notification
|
||||||
|
echo "notify-send '$MESSAGE' 'Reminder' -u critical" | at $TIME 2>/dev/null
|
||||||
|
echo "Notification scheduled at $TIME"
|
||||||
|
}
|
||||||
|
|
||||||
|
remind "$@"
|
||||||
Reference in New Issue
Block a user