Battery percentage without % sign (#730)
This commit is contained in:
@@ -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
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user