mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-30 23:42:42 +01:00 
			
		
		
		
	fix(battery): multiple paths
This commit is contained in:
		| @@ -96,6 +96,7 @@ | |||||||
|         "format": "{capacity}% {icon}", |         "format": "{capacity}% {icon}", | ||||||
|         "format-charging": "{capacity}% ", |         "format-charging": "{capacity}% ", | ||||||
|         "format-plugged": "{capacity}% ", |         "format-plugged": "{capacity}% ", | ||||||
|  |         "format-alt": "{time} {icon}", | ||||||
|         // "format-good": "", // An empty format will hide the module |         // "format-good": "", // An empty format will hide the module | ||||||
|         // "format-full": "", |         // "format-full": "", | ||||||
|         "format-icons": ["", "", "", "", ""] |         "format-icons": ["", "", "", "", ""] | ||||||
|   | |||||||
| @@ -91,9 +91,12 @@ const std::tuple<uint8_t, float, std::string> waybar::modules::Battery::getInfos | |||||||
|       std::string _status; |       std::string _status; | ||||||
|       std::ifstream(bat / "capacity") >> capacity; |       std::ifstream(bat / "capacity") >> capacity; | ||||||
|       std::ifstream(bat / "status") >> _status; |       std::ifstream(bat / "status") >> _status; | ||||||
|       std::ifstream(bat / "power_now") >> power_now; |       auto rate_path = fs::exists(bat / "current_now") ? "current_now" : "power_now"; | ||||||
|       std::ifstream(bat / "energy_now") >> energy_now; |       std::ifstream(bat / rate_path) >> power_now; | ||||||
|       std::ifstream(bat / "energy_full") >> energy_full; |       auto now_path = fs::exists(bat / "charge_now") ? "charge_now" : "energy_now"; | ||||||
|  |       std::ifstream(bat / now_path) >> energy_now; | ||||||
|  |       auto full_path = fs::exists(bat / "charge_full") ? "charge_full" : "energy_full"; | ||||||
|  |       std::ifstream(bat / full_path) >> energy_full; | ||||||
|       if (_status != "Unknown") { |       if (_status != "Unknown") { | ||||||
|         status = _status; |         status = _status; | ||||||
|       } |       } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alex
					Alex