86 lines
1.8 KiB
Bash
Executable File
86 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# 2025-11-10 Hyperling
|
|
# Icons: https://fontawesome.com/v4/cheatsheet/
|
|
|
|
source "`which volume.function`"
|
|
source "`which battery.function`"
|
|
source "`which storage.function`"
|
|
|
|
function datetime {
|
|
date +"%Y-%m-%d %H:%M:%S"
|
|
}
|
|
function status-display {
|
|
# Defaults
|
|
cmd="echo"
|
|
sleep=0.2
|
|
if [[ "`storage-root`" == "`storage-home`" ]]; then
|
|
function status-display-storage {
|
|
echo "`storage-root`"
|
|
}
|
|
else
|
|
function status-display-storage {
|
|
echo "Root (`storage-root`), Home (`storage-home`)"
|
|
}
|
|
fi
|
|
|
|
# Test Config
|
|
if [[ $1 == "-t" || $1 == "--test" || $1 == "test" ]]; then
|
|
sleep=5
|
|
fi
|
|
|
|
# DWM Config
|
|
if [[ $1 == "-d" || $1 == "--dwm" || $1 == "dwm" ]]; then
|
|
cmd="xsetroot -name"
|
|
if [[ "`storage-root`" == "`storage-home`" ]]; then
|
|
function status-display-storage {
|
|
echo "`storage-root-dwm`)"
|
|
}
|
|
else
|
|
function status-display-storage {
|
|
echo "(Root `storage-root-dwm`, Home `storage-home-dwm`)"
|
|
}
|
|
fi
|
|
fi
|
|
battery=""; storage=""; volume=""; datetime="";
|
|
userhost="`whoami`@`hostname`"
|
|
while true; do
|
|
# Exit if parent process is gone.
|
|
#TBD/TODO
|
|
|
|
# Reset Variables
|
|
if [[ $datetime == *"00" ]]; then
|
|
unset battery
|
|
unset storage
|
|
fi
|
|
if [[ $datetime != "`datetime`" ]]; then
|
|
unset volume
|
|
unset datetime
|
|
fi
|
|
|
|
# Set Variables
|
|
if [[ -z $battery ]]; then
|
|
battery="`battery-display`"
|
|
fi
|
|
if [[ -z $storage ]]; then
|
|
storage="`status-display-storage`"
|
|
fi
|
|
if [[ -z $volume ]]; then
|
|
volume="`volume-display`"
|
|
fi
|
|
if [[ -z $datetime ]]; then
|
|
datetime="`datetime`"
|
|
fi
|
|
|
|
# Display Variables
|
|
readout="$readout $battery"
|
|
readout="$readout | $storage"
|
|
readout="$readout | $volume"
|
|
readout="$readout | $userhost"
|
|
readout="$readout | $datetime"
|
|
$cmd "$readout"
|
|
readout=""
|
|
sleep $sleep
|
|
done
|
|
}
|
|
alias status="status-display --test"
|