diff --git a/completions/bash b/completions/bash index 47877db6f..aa4182ec1 100644 --- a/completions/bash +++ b/completions/bash @@ -177,6 +177,9 @@ __fastfetch_completion() "--allow-slow-operations" "--disable-linewrap" "--hide-cursor" + "--cpu-temp" + "--gpu-temp" + "--battery-temp" "--localip-show-ipv4" "--localip-show-ipv6" "--localip-show-loop" diff --git a/src/data/help.txt b/src/data/help.txt index eb02e6df5..a5588f15f 100644 --- a/src/data/help.txt +++ b/src/data/help.txt @@ -94,6 +94,9 @@ Module specific options: --disk-folders : A colon separated list of folder paths for the disk output. Default is "/:/home" --disk-removable : Sets if removable volume should be printed. Default is false --battery-dir : The directory where the battery folders are. Standard: /sys/class/power_supply/ + --cpu-temp : Detect and display CPU temperature if supported. Default is false + --gpu-temp : Detect and display GPU temperature if supported. Default is false + --battery-temp : Detect and display Battery temperature if supported. Default is false --localip-show-ipv4 : Show ipv4 addresses in local ip module. Default is true --localip-show-ipv6 : Show ipv6 addresses in local ip module. Default is false --localip-show-loop : Show loop back addresses (127.0.0.1) in local ip module. Default is false diff --git a/src/detection/battery/battery_apple.c b/src/detection/battery/battery_apple.c index 4c0e65b41..0e9667cf7 100644 --- a/src/detection/battery/battery_apple.c +++ b/src/detection/battery/battery_apple.c @@ -94,7 +94,10 @@ const char* ffDetectBatteryImpl(FFinstance* instance, FFlist* results) else ffStrbufAppendS(&battery->status, ""); - battery->temperature = detectBatteryTemp(); + if(instance->config.batteryTemp) + battery->temperature = detectBatteryTemp(); + else + battery->temperature = FF_BATTERY_TEMP_UNSET; CFRelease(properties); IOObjectRelease(registryEntry); diff --git a/src/detection/cpu/cpu_apple.c b/src/detection/cpu/cpu_apple.c index 971ef228f..dc0c1a3eb 100644 --- a/src/detection/cpu/cpu_apple.c +++ b/src/detection/cpu/cpu_apple.c @@ -69,5 +69,8 @@ void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu, bool cached) cpu->frequencyMax = getFrequency("hw.cpufrequency"); } - cpu->temperature = detectCpuTemp(&cpu->name); + if (instance->config.cpuTemp) + cpu->temperature = detectCpuTemp(&cpu->name); + else + cpu->temperature = FF_CPU_TEMP_UNSET; } diff --git a/src/detection/cpu/cpu_linux.c b/src/detection/cpu/cpu_linux.c index 1d32c3368..83c0f1140 100644 --- a/src/detection/cpu/cpu_linux.c +++ b/src/detection/cpu/cpu_linux.c @@ -80,7 +80,10 @@ static double detectCPUTemp(const FFinstance* instance) void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu, bool cached) { - cpu->temperature = detectCPUTemp(instance); + if(instance->config.cpuTemp) + cpu->temperature = detectCPUTemp(instance); + else + cpu->temperature = FF_CPU_TEMP_UNSET; if(cached) return; diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index 421f7839f..b755d292e 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -84,7 +84,10 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance) if(ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount)) gpu->coreCount = FF_GPU_CORE_COUNT_UNSET; - gpu->temperature = detectGpuTemp(&gpu->name); + if(instance->config.gpuTemp) + gpu->temperature = detectGpuTemp(&gpu->name); + else + gpu->temperature = FF_GPU_TEMP_UNSET; CFRelease(properties); IOObjectRelease(registryEntry); diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index 77d8021c8..8266357ed 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -200,7 +200,8 @@ static void pciHandleDevice(const FFinstance* instance, FFlist* results, PCIData gpu->coreCount = FF_GPU_CORE_COUNT_UNSET; gpu->temperature = FF_GPU_TEMP_UNSET; - pciDetectTemperatur(instance, gpu, device); + if(instance->config.gpuTemp) + pciDetectTemperatur(instance, gpu, device); } static const char* pciDetectGPUs(const FFinstance* instance, FFlist* gpus) diff --git a/src/fastfetch.c b/src/fastfetch.c index 090e84936..0a0f93ba0 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -1253,6 +1253,12 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con //Module options// ////////////////// + else if(strcasecmp(key, "--cpu-temp") == 0) + instance->config.cpuTemp = optionParseBoolean(value); + else if(strcasecmp(key, "--gpu-temp") == 0) + instance->config.gpuTemp = optionParseBoolean(value); + else if(strcasecmp(key, "--battery-temp") == 0) + instance->config.batteryTemp = optionParseBoolean(value); else if(strcasecmp(key, "--title-fqdn") == 0) instance->config.titleFQDN = optionParseBoolean(value); else if(strcasecmp(key, "--disk-folders") == 0) diff --git a/src/fastfetch.h b/src/fastfetch.h index 0eb435ec2..6eaf48f90 100644 --- a/src/fastfetch.h +++ b/src/fastfetch.h @@ -152,6 +152,10 @@ typedef struct FFconfig FFstrbuf libplist; FFstrbuf libcJSON; + bool cpuTemp; + bool gpuTemp; + bool batteryTemp; + bool titleFQDN; FFstrbuf diskFolders;