From edc0b126e9bd5d6d5d62ca6b9b043dff24a5445e Mon Sep 17 00:00:00 2001 From: Washik Date: Mon, 2 Feb 2026 01:43:04 +0100 Subject: [PATCH 1/3] added-unlimited-icon-option --- docs/widgets/(Widget)-Battery.md | 5 +++-- src/core/validation/widgets/yasb/battery.py | 2 ++ src/core/widgets/yasb/battery.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/widgets/(Widget)-Battery.md b/docs/widgets/(Widget)-Battery.md index 6cd6d4233..b01f4ed74 100644 --- a/docs/widgets/(Widget)-Battery.md +++ b/docs/widgets/(Widget)-Battery.md @@ -10,7 +10,7 @@ | `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. | -| `status_icons` | dict | `{icon_charging: '\uf0e7', icon_critical: '\uf244', icon_low: '\uf243', icon_medium: '\uf242', icon_high: '\uf241', icon_full: '\uf240'}` | Icons for different battery statuses. | +| `status_icons` | dict | `{icon_charging: '\uf0e7', icon_critical: '\uf244', icon_low: '\uf243', icon_medium: '\uf242', icon_high: '\uf241', icon_full: '\uf240', icon_unlimited: '\u221e'}` | Icons for different battery statuses. | | `callbacks` | dict | `{on_left: 'toggle_label', on_middle: 'do_nothing', on_right: 'do_nothing'}` | Callback functions for different mouse button actions. | | `animation` | dict | `{'enabled': True, 'type': 'fadeInOut', 'duration': 200}` | Animation settings for the widget. | | `container_shadow` | dict | `None` | Container shadow options. | @@ -96,6 +96,7 @@ battery: - **icon_medium**: The icon for medium status. - **icon_high**: The icon for high status. - **icon_full**: The icon for full status. + - **icon_unlimited**: The icon for unlimited time remaining. - **callbacks**: A dictionary specifying the callbacks for mouse events. It contains: - **on_left**: The name of the callback function for left mouse button click. - **on_middle**: The name of the callback function for middle mouse button click. @@ -173,4 +174,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 6416a6e38..32775f1d6 100644 --- a/src/core/validation/widgets/yasb/battery.py +++ b/src/core/validation/widgets/yasb/battery.py @@ -20,6 +20,7 @@ "icon_medium": "\uf242", "icon_high": "\uf241", "icon_full": "\uf240", + "icon_unlimited": "unlimited", }, "animation": {"enabled": True, "type": "fadeInOut", "duration": 200}, "container_padding": {"top": 0, "left": 0, "bottom": 0, "right": 0}, @@ -67,6 +68,7 @@ "icon_medium": {"type": "string", "default": DEFAULTS["status_icons"]["icon_medium"]}, "icon_high": {"type": "string", "default": DEFAULTS["status_icons"]["icon_high"]}, "icon_full": {"type": "string", "default": DEFAULTS["status_icons"]["icon_full"]}, + "icon_unlimited": {"type": "string", "default": DEFAULTS["status_icons"]["icon_unlimited"]}, }, "default": DEFAULTS["status_icons"], }, diff --git a/src/core/widgets/yasb/battery.py b/src/core/widgets/yasb/battery.py index 361a774e4..101d201f9 100644 --- a/src/core/widgets/yasb/battery.py +++ b/src/core/widgets/yasb/battery.py @@ -98,7 +98,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._status_icons["icon_unlimited"] elif secs_left == POWER_TIME_UNKNOWN: time_left = "unknown" elif isinstance(secs_left, int) and secs_left >= 0: From 3db8ac9bf1fa7e6636b3c7771f1ea2d9da4fd8bb Mon Sep 17 00:00:00 2001 From: Washik Date: Wed, 4 Feb 2026 19:53:04 +0100 Subject: [PATCH 2/3] get-time-remaining-modified --- src/core/widgets/yasb/battery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/widgets/yasb/battery.py b/src/core/widgets/yasb/battery.py index c72a77b6f..44847b64e 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 = self._status_icons["icon_unlimited"] + time_left = self.config.status_icons.icon_unlimited elif secs_left == POWER_TIME_UNKNOWN: time_left = "unknown" elif secs_left >= 0: From 3dc135f00fba74cb35a5e04d2e08886c99d90874 Mon Sep 17 00:00:00 2001 From: Washik Date: Sun, 8 Feb 2026 21:34:26 +0100 Subject: [PATCH 3/3] renamed and moved --- docs/widgets/(Widget)-Battery.md | 5 +++-- src/core/validation/widgets/yasb/battery.py | 2 +- src/core/widgets/yasb/battery.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/widgets/(Widget)-Battery.md b/docs/widgets/(Widget)-Battery.md index b01f4ed74..e7c660b50 100644 --- a/docs/widgets/(Widget)-Battery.md +++ b/docs/widgets/(Widget)-Battery.md @@ -7,10 +7,11 @@ | `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. | -| `status_icons` | dict | `{icon_charging: '\uf0e7', icon_critical: '\uf244', icon_low: '\uf243', icon_medium: '\uf242', icon_high: '\uf241', icon_full: '\uf240', icon_unlimited: '\u221e'}` | Icons for different battery statuses. | +| `status_icons` | dict | `{icon_charging: '\uf0e7', icon_critical: '\uf244', icon_low: '\uf243', icon_medium: '\uf242', icon_high: '\uf241', icon_full: '\uf240'}` | Icons for different battery statuses. | | `callbacks` | dict | `{on_left: 'toggle_label', on_middle: 'do_nothing', on_right: 'do_nothing'}` | Callback functions for different mouse button actions. | | `animation` | dict | `{'enabled': True, 'type': 'fadeInOut', 'duration': 200}` | Animation settings for the widget. | | `container_shadow` | dict | `None` | Container shadow options. | @@ -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}`. @@ -96,7 +98,6 @@ battery: - **icon_medium**: The icon for medium status. - **icon_high**: The icon for high status. - **icon_full**: The icon for full status. - - **icon_unlimited**: The icon for unlimited time remaining. - **callbacks**: A dictionary specifying the callbacks for mouse events. It contains: - **on_left**: The name of the callback function for left mouse button click. - **on_middle**: The name of the callback function for middle mouse button click. diff --git a/src/core/validation/widgets/yasb/battery.py b/src/core/validation/widgets/yasb/battery.py index 1fba1c4de..5041b3f8f 100644 --- a/src/core/validation/widgets/yasb/battery.py +++ b/src/core/validation/widgets/yasb/battery.py @@ -31,7 +31,6 @@ class StatusIconsConfig(CustomBaseModel): icon_medium: str = "\uf242" icon_high: str = "\uf241" icon_full: str = "\uf240" - icon_unlimited: str = "unlimited" class CallbacksBatteryConfig(CallbacksConfig): @@ -44,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 44847b64e..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 = self.config.status_icons.icon_unlimited + time_left = self.config.time_remaining_unlimited_icon elif secs_left == POWER_TIME_UNKNOWN: time_left = "unknown" elif secs_left >= 0: