mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 02:24:11 -06:00
feat: add reminder banner template for bash/fish shells
This commit is contained in:
@@ -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 }}
|
||||||
@@ -15,6 +15,9 @@ case $- in
|
|||||||
*) return;;
|
*) return;;
|
||||||
esac
|
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.
|
# don't put duplicate lines or lines starting with space in the history.
|
||||||
# See bash(1) for more options
|
# See bash(1) for more options
|
||||||
HISTCONTROL=ignoreboth
|
HISTCONTROL=ignoreboth
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
# Disable greeting
|
# Disable greeting
|
||||||
set -g fish_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 .wsl }}
|
||||||
if status is-login
|
if status is-login
|
||||||
and status is-interactive
|
and status is-interactive
|
||||||
|
|||||||
Reference in New Issue
Block a user