#!/usr/bin/env bash
# Calculate the seconds elapsed in the current day
SEC=$(date +%S)
MIN=$(date +%M)
HOUR=$(date +%-H)
TOTAL_SEC=$(( (HOUR * 3600) + (MIN * 60) + SEC ))

# Total seconds in a 24-hour day
DAY_SEC=86400

# Calculate the exact percentage (scaled to an integer)
PERCENT=$(( (TOTAL_SEC * 100) / DAY_SEC ))

# Define bar length and determine filled vs empty segments
BAR_LENGTH=40
FILLED=$(( (PERCENT * BAR_LENGTH) / 100 ))
EMPTY=$(( BAR_LENGTH - FILLED ))

# Create the visual bar using characters (Customize these as you like!)
BAR=$(printf "%0.s█" $(seq 1 $FILLED))$(printf "%0.s░" $(seq 1 $EMPTY))

# Output the final string
echo "$PERCENT% | $BAR"

