- Rewrite README.md in English with detailed features, installation, usage, and configuration instructions - Update plugin name and repository references to "tmux-remind" - Change script comments and popup titles from Italian to English - Standardize less status line in show_calendar.sh to English
48 lines
1.1 KiB
Bash
Executable File
48 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# Function to read tmux options with default values
|
|
get_tmux_option() {
|
|
local option="$1"
|
|
local default_value="$2"
|
|
local option_value
|
|
option_value=$(tmux show-option -gqv "$option")
|
|
if [ -z "$option_value" ]; then
|
|
echo "$default_value"
|
|
else
|
|
echo "$option_value"
|
|
fi
|
|
}
|
|
|
|
# Example: read user configuration
|
|
# my_option=$(get_tmux_option "@plugin_option" "default_value")
|
|
|
|
function get_datetime {
|
|
date "+%d/%m/%Y %H:%M"
|
|
}
|
|
|
|
function show_reminders {
|
|
local datetime
|
|
datetime=$(get_datetime)
|
|
tmux display-popup -T "#[align=centre]Today's Reminders - $datetime" -w 60% -h 60% -x C -y C -E -- "$CURRENT_DIR/show_reminders.sh"
|
|
}
|
|
|
|
function show_calendar {
|
|
local datetime
|
|
datetime=$(get_datetime)
|
|
tmux display-popup -T "#[align=centre]Next 2 Weeks - $datetime" -w 99% -h 99% -x C -y C -E -- "$CURRENT_DIR/show_calendar.sh"
|
|
}
|
|
|
|
function main {
|
|
if [ "$1" == "reminders" ]; then
|
|
show_reminders
|
|
else
|
|
show_calendar
|
|
fi
|
|
}
|
|
|
|
main "$@"
|