cputemp configurable path
This commit is contained in:
parent
de2e6017f5
commit
6901ac4b4f
@ -3,6 +3,7 @@ use std::default::Default;
|
|||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct CpuTemp {
|
pub struct CpuTemp {
|
||||||
|
pub path: String,
|
||||||
pub icon: String,
|
pub icon: String,
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub delay: f64,
|
pub delay: f64,
|
||||||
@ -11,6 +12,7 @@ pub struct CpuTemp {
|
|||||||
impl Default for CpuTemp {
|
impl Default for CpuTemp {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
CpuTemp {
|
CpuTemp {
|
||||||
|
path: String::from("/sys/class/thermal/thermal_zone0/temp"),
|
||||||
icon: String::from(""),
|
icon: String::from(""),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
delay: 120.0,
|
delay: 120.0,
|
||||||
|
@ -84,6 +84,7 @@ pub struct Battery {
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct CpuTemp {
|
pub struct CpuTemp {
|
||||||
|
pub path: String,
|
||||||
pub icon: String,
|
pub icon: String,
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub delay: f64,
|
pub delay: f64,
|
||||||
|
@ -4,7 +4,7 @@ use std::fs::read_to_string;
|
|||||||
|
|
||||||
// getting cpu temperature
|
// getting cpu temperature
|
||||||
pub async fn get_cpu_temp() -> ThreadsData {
|
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,
|
Ok(data) => data,
|
||||||
_ => return ThreadsData::CpuTemp(String::from("Error reading temp")),
|
_ => return ThreadsData::CpuTemp(String::from("Error reading temp")),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user