Add battery capacity support on FreeBSD (#988)

## What are the changes about?

So far ly only supported showing battery capacity on Linux. This adds support for FreeBSD as well using `sysctlbyname()` instead of reading from `/sys/...`

## What existing issue does this resolve?

No battery shown on FreeBSD.

_Replace this with a reference to an existing issue, or N/A if there is none_

## Pre-requisites

- [x] I have tested & confirmed the changes work locally
- [x] I have run `zig fmt` throughout my changes

Co-authored-by: AnErrupTion <anerruption+codeberg@disroot.org>
Co-authored-by: AnErrupTion <anerruption@disroot.org>
Reviewed-on: https://codeberg.org/fairyglade/ly/pulls/988
Reviewed-by: AnErrupTion <anerruption+codeberg@disroot.org>
This commit is contained in:
Lars Engels
2026-07-05 21:19:30 +02:00
committed by AnErrupTion
parent 1d272ff74f
commit cf731dbce1
4 changed files with 29 additions and 9 deletions

View File

@@ -50,6 +50,7 @@ auth_fails = 10
# Identifier for battery whose charge to display at top left
# Primary battery is usually BAT0 or BAT1
# If set to null, battery status won't be shown
# Unused on FreeBSD (a sysctl is used there)
battery_id = null
# Automatic login configuration