Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/neofetch/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- Makefile 18 Jul 2018 09:28:55 -0000 1.1.1.1
+++ Makefile 13 Aug 2018 16:52:15 -0000
@@ -2,6 +2,7 @@
COMMENT = system information tool written in bash
CATEGORIES = sysutils misc
+REVISION = 0
GH_ACCOUNT = dylanaraps
GH_PROJECT = neofetch
Index: patches/patch-neofetch
===================================================================
RCS file: patches/patch-neofetch
diff -N patches/patch-neofetch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-neofetch 13 Aug 2018 16:52:15 -0000
@@ -0,0 +1,30 @@
+$OpenBSD$
+Battery fixes. Add support for amphour and charging status.
+From upstream 71df4ffd3b20abaf21c260c5a109793d579dfa11
+Index: neofetch
+--- neofetch.orig
++++ neofetch
+@@ -3179,12 +3179,19 @@ get_battery() {
+ ;;
+
+ "OpenBSD"* | "Bitrig"*)
+- battery0full="$(sysctl -n hw.sensors.acpibat0.watthour0)"
+- battery0full="${battery0full/ Wh*}"
++ battery0full="$(sysctl -n hw.sensors.acpibat0.watthour0\
++ hw.sensors.acpibat0.amphour0)"
++ battery0full="${battery0full%% *}"
+
+- battery0now="$(sysctl -n hw.sensors.acpibat0.watthour3)"
+- battery0now="${battery0now/ Wh*}"
++ battery0now="$(sysctl -n hw.sensors.acpibat0.watthour3\
++ hw.sensors.acpibat0.amphour3)"
++ battery0now="${battery0now%% *}"
+
++ state="$(sysctl -n hw.sensors.acpibat0.raw0)"
++ state="${state##? (battery }"
++ state="${state%)*}"
++
++ [[ "${state}" == "charging" ]] && battery_state="charging"
+ [[ "$battery0full" ]] && \
+ battery="$((100 * ${battery0now/\.} / ${battery0full/\.}))%"
+ ;;
Hi ports!
Here is a patch for neofetch that got upstreamed [1]. It adds support
for hw.sensors.acpibat0.amphour kernel states so battery status is
reported on any laptop, and charging status.
To test the feature you'll need to uncomment info "Battery" in
~/.config/neofetch/config.conf
They're still non-working-but-silented features for neofetch on
OpenBSD, that i've added/fixed [2]. My plan was to wait to make a
single patch, but upstream is slow to react (almost 1 month as i'm
writing this), and the code tested only on my machines, so i won't
add them for now.
Reviews and OK are welcome!
Charlène.
[1] https://github.com/dylanaraps/neofetch/pull/1056
[2] https://github.com/dylanaraps/neofetch/pull/1058
No comments:
Post a Comment