Skip to content

Commit

Permalink
remove: date from datetime
Browse files Browse the repository at this point in the history
also switches colour of time to yellow to test how it looks
  • Loading branch information
mark-pitblado committed Nov 23, 2024
1 parent fc679d0 commit 9c0e9c2
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions src/datetime-widget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
. "${ROOT_DIR}/lib/coreutils-compat.sh"

# Grab global variable for showing datetime widget, only hide if explicitly disabled
SHOW_DATETIME=$(tmux show-option -gv @tokyo-night-tmux_show_datetime 2>/dev/null)
SHOW_DATETIME=$(tmux show-option -gv @catppuccin-tmux_show_datetime 2>/dev/null)
if [[ $SHOW_DATETIME == "0" ]]; then
exit 0
fi
Expand All @@ -14,28 +14,10 @@ CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source $CURRENT_DIR/themes.sh

# Assign values based on user config
date_format=$(tmux show-option -gv @tokyo-night-tmux_date_format 2>/dev/null)
time_format=$(tmux show-option -gv @tokyo-night-tmux_time_format 2>/dev/null)
time_format=$(tmux show-option -gv @catppuccin-tmux_time_format 2>/dev/null)

date_string=""
time_string=""

if [[ $date_format == "YMD" ]]; then
# Year Month Day date format
date_string=" %Y-%m-%d"
elif [[ $date_format == "MDY" ]]; then
# Month Day Year date format
date_string=" %m-%d-%Y"
elif [[ $date_format == "DMY" ]]; then
# Day Month Year date format
date_string=" %d-%m-%Y"
elif [[ $date_format == "hide" ]]; then
# Day Month Year date format
date_string=""
else
# Default to YMD date format if not specified
date_string=" %Y-%m-%d"
fi

if [[ $time_format == "12H" ]]; then
# 12-hour format with AM/PM
Expand All @@ -48,9 +30,4 @@ else
time_string="%H:%M "
fi

separator=""
if [[ $date_string && $time_string ]]; then
separator=""
fi

echo "$RESET#[fg=${THEME[foreground]},bg=${THEME[bblack]}]$date_string $separator$time_string"
echo "$RESET#[fg=${THEME[yellow]},bg=${THEME[bblack]}]$date_string $separator$time_string"

0 comments on commit 9c0e9c2

Please sign in to comment.