1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-04-11 03:41:54 +00:00

Make sensor_device a lua setting

I haven't tested if this compiles, but I couldn't have broken much, because before this it
definitely didn't compile.
This commit is contained in:
Pavel Labath 2010-08-27 13:52:21 +02:00
parent ce49490144
commit 68d0a223fb
2 changed files with 5 additions and 16 deletions

View File

@ -465,10 +465,6 @@ static conky::simple_config_setting<bool> utf8_mode("override_utf8_locale",
#endif /* BUILD_X11 */
#ifdef __OpenBSD__
static int sensor_device;
#endif
/* maximum size of config TEXT buffer, i.e. below TEXT line. */
unsigned int max_user_text;
@ -2794,15 +2790,6 @@ char load_config_file(const char *f)
CONF_ERR;
}
}
#ifdef __OpenBSD__
CONF("sensor_device") {
if (value) {
sensor_device = strtol(value, 0, 0);
} else {
CONF_ERR;
}
}
#endif
#ifdef BUILD_X11
#ifdef BUILD_XFT
CONF("font") {

View File

@ -449,6 +449,8 @@ static struct obsd_sensors_struct {
float volt[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
} obsd_sensors;
static conky::simple_config_setting<int> sensor_device("sensor_device", 0, false);
/* read sensors from sysctl */
void update_obsd_sensors()
{
@ -524,7 +526,7 @@ void parse_obsd_sensor(struct text_object *obj, const char *arg)
void print_obsd_sensors_temp(struct text_object *obj, char *p, int p_max_size)
{
obsd_sensors.device = sensor_device;
obsd_sensors.device = sensor_device.get(*state);
update_obsd_sensors();
temp_print(p, p_max_size,
obsd_sensors.temp[obsd_sensors.device][obj->data.l],
@ -533,7 +535,7 @@ void print_obsd_sensors_temp(struct text_object *obj, char *p, int p_max_size)
void print_obsd_sensors_fan(struct text_object *obj, char *p, int p_max_size)
{
obsd_sensors.device = sensor_device;
obsd_sensors.device = sensor_device.get(*state);
update_obsd_sensors();
snprintf(p, p_max_size, "%d",
obsd_sensors.fan[obsd_sensors.device][obj->data.l]);
@ -541,7 +543,7 @@ void print_obsd_sensors_fan(struct text_object *obj, char *p, int p_max_size)
void print_obsd_sensors_volt(struct text_object *obj, char *p, int p_max_size)
{
obsd_sensors.device = sensor_device;
obsd_sensors.device = sensor_device.get(*state);
update_obsd_sensors();
snprintf(p, p_max_size, "%.2f",
obsd_sensors.volt[obsd_sensors.device][obj->data.l]);