diff options
author | Özgür Kesim <oec@codeblau.de> | 2022-01-29 23:23:11 +0100 |
---|---|---|
committer | Özgür Kesim <oec@codeblau.de> | 2022-01-29 23:23:11 +0100 |
commit | 6901ac4b4f1bdd022543badd349e21f6c6ea6988 (patch) | |
tree | 790e681149baca54c2c26bfce5c151da7c90a971 /src | |
parent | de2e6017f5ad0c6d3d6894d64b19c8da4dfe82d0 (diff) |
cputemp configurable path
Diffstat (limited to 'src')
-rw-r--r-- | src/config/cputemp.rs | 2 | ||||
-rw-r--r-- | src/types.rs | 1 | ||||
-rw-r--r-- | src/utils/cpu.rs | 2 |
3 files changed, 4 insertions, 1 deletions
diff --git a/src/config/cputemp.rs b/src/config/cputemp.rs index 39b43b0..a219e91 100644 --- a/src/config/cputemp.rs +++ b/src/config/cputemp.rs @@ -3,6 +3,7 @@ use std::default::Default; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct CpuTemp { + pub path: String, pub icon: String, pub enabled: bool, pub delay: f64, @@ -11,6 +12,7 @@ pub struct CpuTemp { impl Default for CpuTemp { fn default() -> Self { CpuTemp { + path: String::from("/sys/class/thermal/thermal_zone0/temp"), icon: String::from(""), enabled: false, delay: 120.0, diff --git a/src/types.rs b/src/types.rs index a26ffc2..7f6da2e 100644 --- a/src/types.rs +++ b/src/types.rs @@ -84,6 +84,7 @@ pub struct Battery { #[derive(Clone)] pub struct CpuTemp { + pub path: String, pub icon: String, pub enabled: bool, pub delay: f64, diff --git a/src/utils/cpu.rs b/src/utils/cpu.rs index f49fda0..cb94f0d 100644 --- a/src/utils/cpu.rs +++ b/src/utils/cpu.rs @@ -4,7 +4,7 @@ use std::fs::read_to_string; // getting cpu temperature pub async fn get_cpu_temp() -> ThreadsData { - let buf = match read_to_string("/sys/class/thermal/thermal_zone0/temp") { + let buf = match read_to_string(&CONFIG.cpu_temperature.path) { Ok(data) => data, _ => return ThreadsData::CpuTemp(String::from("Error reading temp")), }; |