diff --git a/src/bin/system/machine/machine.bogox b/src/bin/system/machine/machine.bogox index 595b9d9..b16fa83 100644 --- a/src/bin/system/machine/machine.bogox +++ b/src/bin/system/machine/machine.bogox @@ -14,8 +14,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if defined(__linux__) - #include char * @@ -66,8 +64,6 @@ strsli_printf(const char *fmt, ...) return buf; } -#endif - #if defined(__FreeBSD__) || defined(__DragonFly__) static long int _sysctlfromname(const char *name, void *mib, int depth, size_t *len) diff --git a/src/bin/system/machine/sensors.bogox b/src/bin/system/machine/sensors.bogox index eddfa68..47638d0 100644 --- a/src/bin/system/machine/sensors.bogox +++ b/src/bin/system/machine/sensors.bogox @@ -51,7 +51,8 @@ system_sensors_thermal_get(int *sensor_count) if (snsr.type != SENSOR_TEMP) continue; - sensors = realloc(sensors, (1 + *sensor_count) * sizeof(sensor_t *)); + void *tmp = realloc(sensors, (1 + *sensor_count) * sizeof(sensor_t *)); + sensors = tmp; sensors[(*sensor_count)++] = sensor = calloc(1, sizeof(sensor_t)); sensor->name = strdup(snsrdev.xname); sensor->value = (snsr.value - 273150000) / 1000000.0; // (uK -> C) @@ -63,11 +64,29 @@ system_sensors_thermal_get(int *sensor_count) if ((sysctlbyname("hw.acpi.thermal.tz0.temperature", &value, &len, NULL, 0)) != -1) { - sensors = realloc(sensors, (1 + *sensor_count) * sizeof(sensor_t *)); + void *tmp = realloc(sensors, (1 + *sensor_count) * sizeof(sensor_t *)); + sensors = tmp; sensors[(*sensor_count)++] = sensor = calloc(1, sizeof(sensor_t)); sensor->name = strdup("hw.acpi.thermal.tz0"); sensor->value = (float) (value - 2732) / 10; } + + int n = system_cpu_count_get(); + + for (int i = 0; i < n; i++) + { + len = sizeof(value); + const char *mibname = strsli_printf("dev.cpu.%d.temperature", i); + if ((sysctlbyname(mibname, &value, &len, NULL, 0)) != -1) + { + void *tmp = realloc(sensors, (1 + *sensor_count) * sizeof(sensor_t *)); + sensors = tmp; + sensors[(*sensor_count)++] = sensor = calloc(1, sizeof(sensor_t)); + sensor->name = strdup(mibname); + sensor->value = (float) (value - 2732) / 10; + } + } + #elif defined(__linux__) sensor_t *sensor; DIR *dir; diff --git a/src/bin/ui/ui_cpu.c b/src/bin/ui/ui_cpu.c index cc333fa..6050660 100644 --- a/src/bin/ui/ui_cpu.c +++ b/src/bin/ui/ui_cpu.c @@ -481,6 +481,7 @@ void ui_win_cpu_add(Ui *ui) { Evas_Object *win, *box, *scroller; + Evas_Coord x, y; if (ui->cpu.win) { @@ -512,6 +513,9 @@ ui_win_cpu_add(Ui *ui) elm_object_content_set(scroller, box); elm_object_content_set(win, scroller); - evisum_child_window_show(ui->win, win); + evas_object_geometry_get(ui->win, &x, &y, NULL, NULL); + evas_object_resize(win, UI_CHILD_WIN_WIDTH * 1.5, UI_CHILD_WIN_HEIGHT); + evas_object_move(win, x + 20, y + 20); + evas_object_show(win); } diff --git a/src/bin/ui/ui_sensors.c b/src/bin/ui/ui_sensors.c index 4ee0764..8d72629 100644 --- a/src/bin/ui/ui_sensors.c +++ b/src/bin/ui/ui_sensors.c @@ -121,7 +121,7 @@ _sensor_usage_add(Evas_Object *box, sensor_t **sensors, int count) evas_object_size_hint_align_set(pb, FILL, FILL); evas_object_size_hint_weight_set(pb, EXPAND, EXPAND); elm_progressbar_span_size_set(pb, 1.0); - elm_progressbar_unit_format_set(pb, "%1.0f°C"); + elm_progressbar_unit_format_set(pb, "%1.1f°C"); elm_progressbar_value_set(pb, (double) snsr->value / 100); evas_object_show(pb);