Move function files to their own folder. Move the copy to General from Workstation. Leave dwm-status function under Workstation.
This commit is contained in:
38
files/functions/storage.function
Executable file
38
files/functions/storage.function
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# 2025-11-10 Hyperling
|
||||
|
||||
function storage-display {
|
||||
location="$1"
|
||||
style="$2"
|
||||
|
||||
if [[ -z "$location" ]]; then
|
||||
echo "ERROR: Location must be passed. $location"
|
||||
fi
|
||||
|
||||
if [[ "$style" == "%" || "$style" == "pct" || "$style" == "percent" ]]; then
|
||||
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 $4"/"$2" Free"}'
|
||||
elif [[ "$style" == "G" || "$style" == "S" || "$style" == "F" ]]; then
|
||||
df -h "$location" | tail -n 1 | awk '{print $4" Free"}'
|
||||
else
|
||||
df -h "$location" | tail -n 1 | awk '{print $5" Used, "$4"/"$2" Free"}'
|
||||
fi
|
||||
}
|
||||
alias storage='echo -n "Root: " && storage-display "/" "F" && echo -n "Home: " && storage-display "/home" "F"'
|
||||
|
||||
export dwm_storage_style="F"
|
||||
|
||||
function storage-root {
|
||||
storage-display / "$1"
|
||||
}
|
||||
function storage-root-dwm {
|
||||
storage-root "$dwm_storage_style"
|
||||
}
|
||||
|
||||
function storage-home {
|
||||
storage-display /home "$1"
|
||||
}
|
||||
function storage-home-dwm {
|
||||
storage-home "$dwm_storage_style"
|
||||
}
|
||||
Reference in New Issue
Block a user