Compare commits
3 Commits
4b73dc336c
...
e6947d4a30
| Author | SHA1 | Date | |
|---|---|---|---|
| e6947d4a30 | |||
| b0762c7baf | |||
| ce67c2a5b8 |
@@ -2,7 +2,17 @@
|
||||
# 2025-11-10 Hyperling
|
||||
|
||||
function battery-display {
|
||||
detailed="N"
|
||||
if [[ -n $1 ]]; then
|
||||
detailed="Y"
|
||||
fi
|
||||
|
||||
if [[ "$detailed" == "Y" ]]; then
|
||||
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | grep -o "[0-9.%]*"
|
||||
else
|
||||
int="`upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | grep -o "[0-9]*" | head -n 1`"
|
||||
echo "${int}%"
|
||||
fi
|
||||
}
|
||||
alias show-battery="battery-display"
|
||||
alias battery="battery-display"
|
||||
|
||||
64
files/dwm/dwm-status.function
Executable file
64
files/dwm/dwm-status.function
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/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 dwm-status {
|
||||
cmd="xsetroot -name "
|
||||
if [[ $1 == "-t" || $1 == "--test" || $1 == "test" ]]; then
|
||||
cmd="echo"
|
||||
fi
|
||||
|
||||
if [[ "`storage-root`" == "`storage-home`" ]]; then
|
||||
function dwm-status-storage {
|
||||
echo "`storage-root-dwm`)"
|
||||
}
|
||||
else
|
||||
function dwm-status-storage {
|
||||
echo "(Root `storage-root-dwm`, Home `storage-home-dwm`)"
|
||||
}
|
||||
fi
|
||||
battery=""; storage=""; volume=""; datetime="";
|
||||
while true; do
|
||||
# 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="`dwm-status-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 | `whoami`@`hostname`"
|
||||
readout="$readout $datetime"
|
||||
$cmd "$readout"
|
||||
readout=""
|
||||
sleep 0.2
|
||||
done
|
||||
}
|
||||
alias status="dwm-status --test"
|
||||
@@ -35,29 +35,8 @@ xsetroot -solid "$purple"
|
||||
#exec slstatus &
|
||||
|
||||
# Custom Setup #
|
||||
# Icons: https://fontawesome.com/v4/cheatsheet/
|
||||
source "`which volume.function`"
|
||||
source "`which battery.function`"
|
||||
source "`which storage.function`"
|
||||
if [[ "`storage-root`" == "`storage-home`" ]]; then
|
||||
function dwm-storage {
|
||||
echo "`storage-root-dwm`)"
|
||||
}
|
||||
else
|
||||
function dwm-storage {
|
||||
echo "(Root `storage-root-dwm`, Home `storage-home-dwm`)"
|
||||
}
|
||||
fi
|
||||
while true; do
|
||||
readout="$readout `battery-display`"
|
||||
readout="$readout | `dwm-storage`"
|
||||
readout="$readout | `volume-display`"
|
||||
readout="$readout | `whoami`@`hostname`"
|
||||
readout="$readout `date +"%Y-%m-%d %H:%M:%S"`"
|
||||
xsetroot -name "$readout"
|
||||
readout=""
|
||||
sleep 0.2
|
||||
done &
|
||||
source "`which dwm-status.function`"
|
||||
dwm-status &
|
||||
|
||||
|
||||
## Start ##
|
||||
|
||||
@@ -10,11 +10,11 @@ function storage-display {
|
||||
fi
|
||||
|
||||
if [[ "$style" == "%" || "$style" == "pct" || "$style" == "percent" ]]; then
|
||||
df -h "$location" | tail -n 1 | awk '{print $5}'
|
||||
df -h "$location" | tail -n 1 | awk '{print $5" Used"}'
|
||||
elif [[ "$style" == "/" || "$style" == "use" || "$style" == "usage" ]]; then
|
||||
df -h "$location" | tail -n 1 | awk '{print $3"/"$2}'
|
||||
df -h "$location" | tail -n 1 | awk '{print $4"/"$2" Free"}'
|
||||
else
|
||||
df -h "$location" | tail -n 1 | awk '{print $5" Free, "$3"/"$2" Used"}'
|
||||
df -h "$location" | tail -n 1 | awk '{print $5" Used, "$4"/"$2" Free"}'
|
||||
fi
|
||||
}
|
||||
alias storage='echo -n "Root: " && storage-display "/" && echo -n "Home: " && storage-display "/home"'
|
||||
|
||||
Reference in New Issue
Block a user