mirror of
https://github.com/lptstr/winfetch.git
synced 2026-09-25 16:40:21 -04:00
Add battery info
This commit is contained in:
@@ -411,6 +411,23 @@ function info_pkgs {
|
||||
}
|
||||
|
||||
|
||||
# ===== BATTERY =====
|
||||
function info_battery {
|
||||
$battery = (Get-CimInstance Win32_Battery -CimSession $cimSession -Property EstimatedChargeRemaining).EstimatedChargeRemaining
|
||||
|
||||
$content = if ($battery) {
|
||||
"$battery %"
|
||||
} else {
|
||||
"(none)"
|
||||
}
|
||||
|
||||
return @{
|
||||
title = "Battery"
|
||||
content = $content
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# reset terminal sequences and display a newline
|
||||
Write-Host "$e[0m"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user