Skip to content

feat(battery): add options to toggle percentage and remaining time#2672

Merged
Purian23 merged 4 commits into
AvengeMedia:masterfrom
hthienloc:feat/battery-widget-settings
Jun 22, 2026
Merged

feat(battery): add options to toggle percentage and remaining time#2672
Purian23 merged 4 commits into
AvengeMedia:masterfrom
hthienloc:feat/battery-widget-settings

Conversation

@hthienloc

@hthienloc hthienloc commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

This PR implements customization options for the battery widget on the Dank Bar:

  • Adds two toggle options to the battery widget's 3-dot context menu under Dank Bar settings:
    • Show Percentage: Toggles the display of battery percentage (e.g., 95%) on the bar pill.
      • Only on Battery (Sub-toggle): Only visible and active when "Show Percentage" is enabled. When active, it hides the percentage text when the laptop is plugged in / charging (only displaying it when discharging on battery).
    • Show Remaining Time: Toggles the display of remaining time (e.g., 3h 15m / 45m) on the bar pill.
      • Only on Battery (Sub-toggle): Only visible and active when "Show Remaining Time" is enabled. When active, it hides the remaining time text when the laptop is plugged in / charging (only displaying it when discharging on battery).
    • If both are enabled (and visible), the pill displays them combined as 95% (3h 15m).
  • Adjusts the context menu width to 270 to prevent translation cut-offs (such as "Show Percentage" cutting off in narrow configurations).

Type of change

  • New feature (non-breaking change that adds functionality)

Related issues

Closes #1853

Screenshots / video

image

Checklist

  • My code follows the conventions in CONTRIBUTING.md
  • I have tested my changes locally
  • New user-facing strings are wrapped in I18n.tr() with translator context, reusing existing terms where possible
  • Go changes: ran make fmt, added/updated tests, make test passes, and go mod tidy is clean
  • QML changes: ran make lint-qml with no new warnings

@hthienloc hthienloc marked this pull request as draft June 19, 2026 13:21
@hthienloc hthienloc force-pushed the feat/battery-widget-settings branch from a98853a to 4b15f17 Compare June 19, 2026 13:23
@hthienloc hthienloc marked this pull request as ready for review June 19, 2026 13:26
@hthienloc hthienloc force-pushed the feat/battery-widget-settings branch from 4b15f17 to 1aefd9f Compare June 19, 2026 13:39
@hthienloc hthienloc force-pushed the feat/battery-widget-settings branch from 1aefd9f to 9ac5634 Compare June 19, 2026 16:10

@Purian23 Purian23 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

  1. Add SettingsSpec.js entries The four new globals (showBatteryPercent, showBatteryPercentOnlyOnBattery, showBatteryTime, and showBatteryTimeOnlyOnBattery) aren't in settings spec yet. Let's get those added near the other widget defaults.

  2. Vertical bar combined display The horizontalDisplayText combines percent + time, but verticalDisplayText drops the time when percentage is on.

Everything else looks good, appreciate the contribution!

@hthienloc

Copy link
Copy Markdown
Contributor Author

@Purian23 I made some changes to the battery widget in the vertical bar to make it look more symmetrical when using the remaining time option.

image

@Purian23 Purian23 merged commit a043d47 into AvengeMedia:master Jun 22, 2026
1 check passed
@hthienloc hthienloc deleted the feat/battery-widget-settings branch June 22, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an option to toggle battery percentage for the battery widget

2 participants