Skip to content

Commit

Permalink
update mangohud
Browse files Browse the repository at this point in the history
  • Loading branch information
honjow committed Mar 5, 2025
1 parent a2e24e3 commit 7d7497f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 18 deletions.
26 changes: 10 additions & 16 deletions pkgs/mangohud-git/0001-feat-display-battery-charging-power.patch
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
From 5c309efafdc2cf499e9ff8ea2d6681e20de30762 Mon Sep 17 00:00:00 2001
From dd5e64613b61dd6959e11f0cb6cad4dfe629952d Mon Sep 17 00:00:00 2001
From: honjow <[email protected]>
Date: Wed, 5 Mar 2025 19:39:39 +0800
Subject: [PATCH] feat: display battery charging power
Date: Wed, 5 Mar 2025 20:50:35 +0800
Subject: [PATCH 1/2] feat: display battery charging power

- Remove special handling for charging state in getPower() function
- Display actual power value during battery charging
- Add +/- prefix to power value to indicate charging/discharging status
---
src/battery.cpp | 7 ++++---
src/battery.cpp | 2 +-
src/hud_elements.cpp | 8 +++++++-
2 files changed, 11 insertions(+), 4 deletions(-)
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/battery.cpp b/src/battery.cpp
index e5d311b..297217b 100644
index e5d311b..f4ff2d9 100644
--- a/src/battery.cpp
+++ b/src/battery.cpp
@@ -104,9 +104,10 @@ float BatteryStats::getPower() {
@@ -104,7 +104,7 @@ float BatteryStats::getPower() {
state[i]=current_status;
}

- if (state[i] == "Charging" || state[i] == "Unknown" || state[i] == "Full") {
- return 0;
- }
+ // 移除对充电状态的特殊处理,让充电功率也能显示
+ // if (state[i] == "Charging" || state[i] == "Unknown" || state[i] == "Full") {
+ // return 0;
+ // }
+ if (state[i] != "Charging" && state[i] != "Discharging") {
return 0;
}

if (fs::exists(current_power)) {
std::ifstream input(current_power);
diff --git a/src/hud_elements.cpp b/src/hud_elements.cpp
index e820908..90790fc 100644
--- a/src/hud_elements.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 6a1a3ffce34406f53a470362956d7f96c75b645f Mon Sep 17 00:00:00 2001
From: honjow <[email protected]>
Date: Wed, 5 Mar 2025 22:01:18 +0800
Subject: [PATCH 2/2] Add support for more handheld devices to fan detection

---
src/overlay.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/overlay.cpp b/src/overlay.cpp
index 80ebac5..8d9a86b 100644
--- a/src/overlay.cpp
+++ b/src/overlay.cpp
@@ -866,7 +866,13 @@ void update_fan(){
auto dirs = ls(path.c_str(), "hwmon", LS_DIRS);
for (auto& dir : dirs) {
string full_path = (path + dir + "/name").c_str();
- if (read_line(full_path).find("steamdeck_hwmon") != string::npos){
+ string name = read_line(full_path);
+ if (name.find("steamdeck_hwmon") != string::npos ||
+ name.find("asus") != string::npos ||
+ name.find("aynec") != string::npos ||
+ name.find("gpdfan") != string::npos ||
+ name.find("oxp_ec") != string::npos ||
+ name.find("oxpec") != string::npos){
hwmon_path = path + dir + "/fan1_input";
break;
}
--
2.48.1

6 changes: 4 additions & 2 deletions pkgs/mangohud-git/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ conflicts=('mangohud' 'mangohud-common-git' 'mangoapp')
source=(
"$_pkgname::git+$url"
0001-feat-display-battery-charging-power.patch
0002-Add-support-for-more-handheld-devices-to-fan-detecti.patch
)
sha256sums=('SKIP'
'be2c801398d1a0cf466de5294b410a7c86c194d2c4cc3da678a290c44301d0b6'
)
'2ca0b5ff21c8f65b3c03d6900de8fb6363d8929ceabd5792371d992377978ad4'
'0e212dd3a63ce778536b3c0d1c2d3c3577aa78201b9c843c06bf63d972ace71a'
)

pkgver() {
cd $_pkgname
Expand Down

0 comments on commit 7d7497f

Please sign in to comment.