#!/bin/sh # Get the formatted date and time datetime=$(date "+%a %b %-d, %Y %-l:%M %p %Z") # Get battery percentage battery=$(sysctl -n hw.acpi.battery.life 2>/dev/null) # Handle battery icon if [ -z "$battery" ]; then battery="?" battery_icon="" # Unknown else if [ "$battery" -ge 90 ]; then battery_icon="" elif [ "$battery" -ge 60 ]; then battery_icon="" elif [ "$battery" -ge 30 ]; then battery_icon="" elif [ "$battery" -ge 10 ]; then battery_icon="" else battery_icon="" fi fi # Get connected Wi-Fi SSID (for FreeBSD) # Use ifconfig to get the SSID of wlan0 (adjust if different interface name) wifi_ssid=$(ifconfig wlan0 2>/dev/null | awk '/ssid/ {print $2}' | head -n 1) # Only show Wi-Fi if connected if [ -n "$wifi_ssid" ]; then wifi_output=" $wifi_ssid" else wifi_output="" fi # Build final output output="" [ -n "$wifi_output" ] && output="$wifi_output | " output="$output$battery_icon $battery% | $datetime" # Output the result echo "$output"