1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +00:00

batt fixed? x11 stuff

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@552 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2006-03-07 06:24:58 +00:00
parent 4df5f91016
commit 4f5d0da56f
2 changed files with 6 additions and 12 deletions

View File

@ -4430,11 +4430,6 @@ static void main_loop()
update_text();
#ifdef X11
}
#ifdef OWN_WINDOW
if (own_window) {
set_transparent_background(window.window);
}
#endif
}
if (need_to_update) {
@ -4449,9 +4444,9 @@ static void main_loop()
if (own_window) {
/* resize window if it isn't right size */
if (!fixed_size &&
(text_width + border_margin * 2 !=
(text_width + border_margin * 2 + 1 !=
window.width
|| text_height + border_margin * 2 !=
|| text_height + border_margin * 2 + 1 !=
window.height)) {
window.width =
text_width +
@ -4463,6 +4458,9 @@ static void main_loop()
window.window,
window.width,
window.height);
if (own_window) {
set_transparent_background(window.window);
}
}
/* move window if it isn't in right position */

View File

@ -1087,7 +1087,6 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
{
static int rep, rep2;
char acpi_path[128];
int design_capacity;
snprintf(acpi_path, 127, ACPI_BATTERY_BASE_PATH "/%s/state", bat);
/* don't update battery too often */
@ -1120,9 +1119,6 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
char b[256];
if (fgets(b, 256, fp) == NULL)
break;
if (sscanf(b, "design capacity: %d", &design_capacity) != 0) {
continue;
}
if (sscanf(b, "last full capacity: %d", &acpi_last_full) != 0) {
break;
}
@ -1187,7 +1183,7 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
/* thanks to Lukas Zapletal <lzap@seznam.cz> */
else if (strcmp(charging_state, "charged") == 0) {
if (acpi_last_full != 0 && remaining_capacity != acpi_last_full) {
sprintf(last_battery_str, "charged %d%%", remaining_capacity * 100 / design_capacity);
sprintf(last_battery_str, "charged 100%");
} else {
strcpy(last_battery_str, "charged");
}