mirror of
https://github.com/fairyglade/ly.git
synced 2026-08-06 21:21:58 +00:00
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:
@@ -51,6 +51,7 @@ pub fn build(b: *std.Build) void {
|
||||
} else if (target.result.os.tag == .freebsd) {
|
||||
addCImport(b, mod, translate_c, target, optimize, "kbio", "#include <sys/kbio.h>");
|
||||
addCImport(b, mod, translate_c, target, optimize, "consio", "#include <sys/consio.h>");
|
||||
addCImport(b, mod, translate_c, target, optimize, "sysctl", "#include <sys/sysctl.h>");
|
||||
}
|
||||
|
||||
const mod_tests = b.addTest(.{
|
||||
|
||||
@@ -14,6 +14,9 @@ pub const utmp = @import("utmp");
|
||||
// Exists for X11 support only
|
||||
pub const xcb = @import("xcb");
|
||||
|
||||
// FreeBSD only
|
||||
pub const sysctl = @import("sysctl");
|
||||
|
||||
pub const TimeOfDay = struct {
|
||||
seconds: i64,
|
||||
microseconds: i64,
|
||||
|
||||
Reference in New Issue
Block a user