Battery percentage without % sign (#730)

This commit is contained in:
Chris Lee
2019-03-03 23:13:40 +01:00
parent a859727ff3
commit 7f070b4f45
14 changed files with 3082 additions and 2971 deletions

View File

@@ -174,6 +174,7 @@ void battery_update_text(char *dest, char *format)
// %h : Hours left (estimated).
// %t : Time left. This is equivalent to the old behaviour; i.e. "(plugged in)" or "hrs:mins" otherwise.
// %p : Percentage left. Includes the % sign.
// %P : Percentage left without the % sign.
if (*c == '%') {
c++;
o++; // Skip the format control character.
@@ -202,6 +203,10 @@ void battery_update_text(char *dest, char *format)
snprintf(buf, sizeof(buf), "%d%%", battery_state.percentage);
strnappend(dest, buf, BATTERY_BUF_SIZE);
break;
case 'P':
snprintf(buf, sizeof(buf), "%d", battery_state.percentage);
strnappend(dest, buf, BATTERY_BUF_SIZE);
break;
case 't':
if (battery_state.state == BATTERY_FULL) {
snprintf(buf, sizeof(buf), "Full");

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -5845,7 +5845,8 @@ void create_battery(GtkWidget *parent)
" %m: Minutes left until completely charged/discharged (estimated).\n"
" %h: Hours left until completely charged/discharged (estimated).\n"
" %t: Time left. Shows \"hrs:mins\" when charging/discharging, or \"Full\".\n"
" %p: Percentage. Includes the % sign.";
" %p: Percentage. Includes the % sign.\n"
" %p: Percentage. Without the % sign.";
gtk_tooltips_set_tip(tooltips,
battery_format1,
_(bat_format_spec),