diff --git a/docs/widgets/(Widget)-Battery.md b/docs/widgets/(Widget)-Battery.md index 6cd6d4233..e7c660b50 100644 --- a/docs/widgets/(Widget)-Battery.md +++ b/docs/widgets/(Widget)-Battery.md @@ -7,6 +7,7 @@ | `class_name` | string | `""` | Additional CSS class name for the widget. | | `update_interval` | integer | `5000` | The interval in milliseconds to update the widget. | | `time_remaining_natural`| boolean | `False` | Whether to display the remaining time in a natural format. | +| `time_remaining_unlimited_icon`| string | `unlimited` | Which string to use to display unlimited time remaining. | | `hide_unsupported`| boolean | `True` | Whether to hide the widget if the current system does not have battery info. | | `charging_options` | dict | `{icon_format: '{charging_icon}', blink_charging_icon: True, blink_interval: 500}` | Options for charging state display. | | `status_thresholds` | dict | `{critical: 10, low: 25, medium: 75, high: 95, full: 100}` | Thresholds for different battery statuses. | @@ -78,6 +79,7 @@ battery: - **class_name**: Additional CSS class name for the widget. This allows for custom styling. - **update_interval**: The interval in milliseconds to update the widget. - **time_remaining_natural**: A boolean indicating whether to display the remaining time in a natural format. +- **time_remaining_unlimited_icon**: A string to display unlimited time remaining. - **hide_unsupported**: A boolean indicating whether to hide the widget if the current system does not have battery information. - **charging_options**: A dictionary specifying options for displaying the charging state. It contains: - **icon_format**: The format string for the charging icon. You can use placeholders like `{charging_icon}` and `{icon}`. @@ -173,4 +175,4 @@ battery: .battery-widget .label.status-charging { color: #4dd0e1; } -``` \ No newline at end of file +``` diff --git a/src/core/validation/widgets/yasb/battery.py b/src/core/validation/widgets/yasb/battery.py index 6992a4d02..5041b3f8f 100644 --- a/src/core/validation/widgets/yasb/battery.py +++ b/src/core/validation/widgets/yasb/battery.py @@ -43,6 +43,7 @@ class BatteryConfig(CustomBaseModel): class_name: str = "" update_interval: int = Field(default=5000, ge=0, le=60000) time_remaining_natural: bool = False + time_remaining_unlimited_icon: str = "unlimited" hide_unsupported: bool = True charging_options: ChargingOptionsConfig = ChargingOptionsConfig() status_thresholds: StatusThresholdsConfig = StatusThresholdsConfig() diff --git a/src/core/widgets/yasb/battery.py b/src/core/widgets/yasb/battery.py index ad5b2cce7..bd4b857a5 100644 --- a/src/core/widgets/yasb/battery.py +++ b/src/core/widgets/yasb/battery.py @@ -65,7 +65,7 @@ def _toggle_label(self): def _get_time_remaining(self) -> str: secs_left = self._battery_state.time_remaining if secs_left == POWER_TIME_UNLIMITED: - time_left = "unlimited" + time_left = self.config.time_remaining_unlimited_icon elif secs_left == POWER_TIME_UNKNOWN: time_left = "unknown" elif secs_left >= 0: