Constants


Debug and Refresh Settings

Constants and types for the Battery Boost application.

DEBUG = False module-attribute

Enable debug logging (True/False).

REFRESH_INTERVAL_MS = 1000 module-attribute

Check TLP battery statistics every second. Must be frequent enough to catch changes in charging status.


Themes

Constants and types for the Battery Boost application.

THEME = _THEME module-attribute

Mapping of ThemeName to the corresponding colour scheme.

DEFAULT_THEME = THEME[ThemeName.DARK] module-attribute

Default theme.

ThemeName

Bases: Enum

Available themes.

Currently available themes
  • LIGHT: Light theme
  • DARK: Dark theme
Source code in src/battery_boost/constants.py
19
20
21
22
23
24
25
26
27
class ThemeName(Enum):
    """Available themes.

    Currently available themes:
        - LIGHT: Light theme
        - DARK: Dark theme
    """
    LIGHT = 'light'
    DARK = 'dark'

ThemeKeys

Bases: TypedDict

Colours used in the GUI theme for Battery Boost.

Attributes:

Name Type Description
default_bg str

Background colour of the main window in normal mode.

charge_bg str

Background colour when full charge mode is active.

text str

Colour of standard text.

btn_normal str

Colour of the button in normal mode.

btn_active_normal str

Button colour when pressed in normal mode.

btn_charge str

Colour of the button in full-charge mode.

btn_active_charge str

Button colour when pressed in full-charge mode.

btn_discharge str

Colour of the button when battery is discharging.

btn_active_discharge str

Button colour when pressed while discharging.

btn_discharge_text str

Text colour for the button while discharging.

Source code in src/battery_boost/constants.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class ThemeKeys(TypedDict):
    """Colours used in the GUI theme for Battery Boost.

    Attributes:
        default_bg: Background colour of the main window in normal mode.
        charge_bg: Background colour when full charge mode is active.
        text: Colour of standard text.
        btn_normal: Colour of the button in normal mode.
        btn_active_normal: Button colour when pressed in normal mode.
        btn_charge: Colour of the button in full-charge mode.
        btn_active_charge: Button colour when pressed in full-charge mode.
        btn_discharge: Colour of the button when battery is discharging.
        btn_active_discharge: Button colour when pressed while discharging.
        btn_discharge_text: Text colour for the button while discharging.
    """
    default_bg: str
    charge_bg: str
    text: str
    btn_normal: str
    btn_active_normal: str
    btn_charge: str
    btn_active_charge: str
    btn_discharge: str
    btn_active_discharge: str
    btn_discharge_text: str

Fonts

Constants and types for the Battery Boost application.

FontSizeConfig = tuple[tuple[str, int], tuple[str, int], float] module-attribute

Font size configuration used by the GUI.

Contains
  • (font name, size) for the standard UI font
  • (font name, size) for the small UI font
  • GUI scale factor

FONT_SIZES = _FONT_SIZES module-attribute

Font configurations for the GUI.

  • Keys: size level (1–5)
  • Values: tuple of ((standard font, size), (small font, size), scale factor)

Battery State

Constants and types for the Battery Boost application.

STATES = _STATES module-attribute

Mapping of battery state to UI labels and actions.

BatteryState

Bases: Enum

Battery profiles managed by TLP.

Source code in src/battery_boost/constants.py
124
125
126
127
class BatteryState(Enum):
    """Battery profiles managed by TLP."""
    DEFAULT = 'default'
    RECHARGE = 'recharge'

UIState

Bases: TypedDict

Labels and actions for the battery state displayed in the GUI.

Source code in src/battery_boost/constants.py
130
131
132
133
134
class UIState(TypedDict):
    """Labels and actions for the battery state displayed in the GUI."""
    action: str
    label_text: str
    button_text: str