diff --git a/home/.chezmoitemplates/scripts/reminder-banner.tmpl b/home/.chezmoitemplates/scripts/reminder-banner.tmpl new file mode 100644 index 0000000..b97f94d --- /dev/null +++ b/home/.chezmoitemplates/scripts/reminder-banner.tmpl @@ -0,0 +1,56 @@ +{{- /* Reminder banner for interactive shells */ -}} +{{- /* Shows files in ~/reminders/ when opening a new terminal */ -}} +{{- if eq .shell "fish" }} +# Display reminder banner if files exist in ~/reminders/ +if test -d ~/reminders + set -l reminder_files (ls -1 ~/reminders 2>/dev/null) + set -l reminder_count (count $reminder_files) + + if test $reminder_count -gt 0 + # Detect Nerd Font support (kitty, wezterm, alacritty, vscode, Windows Terminal) + set -l icon "Reminders:" + if set -q KITTY_WINDOW_ID; or set -q WEZTERM_EXECUTABLE; or set -q ALACRITTY_SOCKET; \ + or test "$TERM_PROGRAM" = "vscode"; or set -q WT_SESSION + set icon (printf "\uf435") + end + + if test $reminder_count -eq 1 + echo "$icon $reminder_files[1]" + else + # Build comma-separated list and truncate to 80 chars + set -l file_list (string join ", " $reminder_files) + if test (string length "$file_list") -gt 80 + set file_list (string sub -l 77 "$file_list")"..." + end + echo "$icon $reminder_count reminders: $file_list" + end + end +end +{{- else if eq .shell "bash" }} +# Display reminder banner if files exist in ~/reminders/ +if [ -d ~/reminders ]; then + mapfile -t reminder_files < <(ls -1 ~/reminders 2>/dev/null) + reminder_count=${#reminder_files[@]} + + if [ $reminder_count -gt 0 ]; then + # Detect Nerd Font support (kitty, wezterm, alacritty, vscode, Windows Terminal) + icon="Reminders:" + if [ -n "$KITTY_WINDOW_ID" ] || [ -n "$WEZTERM_EXECUTABLE" ] || [ -n "$ALACRITTY_SOCKET" ] || \ + [ "$TERM_PROGRAM" = "vscode" ] || [ -n "$WT_SESSION" ]; then + icon=$'\uf435' + fi + + if [ $reminder_count -eq 1 ]; then + echo "$icon ${reminder_files[0]}" + else + # Build comma-separated list and truncate to 80 chars + file_list=$(printf '%s, ' "${reminder_files[@]}") + file_list="${file_list%, }" # Remove trailing comma+space + if [ ${#file_list} -gt 80 ]; then + file_list="${file_list:0:77}..." + fi + echo "$icon $reminder_count reminders: $file_list" + fi + fi +fi +{{- end }} diff --git a/home/dot_bashrc.tmpl b/home/dot_bashrc.tmpl index 9000188..b9fb571 100644 --- a/home/dot_bashrc.tmpl +++ b/home/dot_bashrc.tmpl @@ -15,6 +15,9 @@ case $- in *) return;; esac +# Display reminder banner for interactive shells +{{ template "scripts/reminder-banner.tmpl" dict "shell" "bash" }} + # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth diff --git a/home/dot_config/fish/config.fish.tmpl b/home/dot_config/fish/config.fish.tmpl index 0fb23b1..cd6b5ae 100644 --- a/home/dot_config/fish/config.fish.tmpl +++ b/home/dot_config/fish/config.fish.tmpl @@ -4,6 +4,11 @@ # Disable greeting set -g fish_greeting +# Display reminder banner for interactive shells +if status is-interactive + {{ template "scripts/reminder-banner.tmpl" dict "shell" "fish" }} +end + {{- if .wsl }} if status is-login and status is-interactive