all repos — tint2 @ 6e77b59ef828a84ee5a49e658bbe7f904496c9f0

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

battery: Tooltips for FreeBSD
o9000 o9000
commit

6e77b59ef828a84ee5a49e658bbe7f904496c9f0

parent

3a733d7353a18a26f1d8f04b985555d9ea6c7841

1 files changed, 17 insertions(+), 1 deletions(-)

jump to
M src/battery/freebsd.csrc/battery/freebsd.c

@@ -76,7 +76,23 @@ return err;

} char* battery_os_tooltip() { - return strdup("Operating System not supported"); + GString *tooltip = g_string_new(""); + gchar *result; + + g_string_append_printf(tooltip, "Battery\n"); + + gchar *state = (battery_state.state == BATTERY_UNKNOWN) ? "Level" : chargestate2str(battery_state.state); + + g_string_append_printf(tooltip, "\t%s: %s", state, percentage); + + g_string_append_c(tooltip, '\n'); + g_string_append_printf(tooltip, "AC\n"); + g_string_append_printf(tooltip, battery_state.ac_connected ? "\tconnected" : "\tdisconnected"); + + result = tooltip->str; + g_string_free(tooltip, FALSE); + + return result; } #endif