Files
tmux-remind/scripts/main.sh
Paolo Donadeo e2ab9e839a feat: add tmux popup commands for reminders and calendar
- Refactor `main.sh` to support `reminders` and `calendar` commands,
  displaying tmux popups with localized titles and current date/time.
- Add `show_reminders.sh` and `show_calendar.sh` scripts to render
  reminders and 2-week calendar views using `rem`.
- Update `tmux-remind.tmux` to bind `prefix + r` for reminders and
  `prefix + c` for calendar popups.
- Improve script robustness with `set -euo pipefail` and dynamic script
  directory resolution.
2025-12-24 12:40:59 +01:00

49 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
set -x
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Funzione per leggere opzioni tmux con default
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
}
# Esempio: leggi configurazione utente
# my_option=$(get_tmux_option "@plugin_option" "default_value")
function get_italian_datetime {
date "+%d/%m/%Y %H:%M"
}
function show_reminders {
local datetime
datetime=$(get_italian_datetime)
tmux display-popup -T "#[align=centre]Impegni di oggi - $datetime" -w 60% -h 50% -x C -y C -E -- "$CURRENT_DIR/show_reminders.sh"
}
function show_calendar {
local datetime
datetime=$(get_italian_datetime)
tmux display-popup -T "#[align=centre]Prossime 2 settimane - $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 "$@"