battery_boost.helper_functions
¶
Helper functions for Battery Boost.
command_on_path
¶
Return True if command is available in PATH, else False.
Source code in src/battery_boost/helper_functions.py
20 21 22 | |
get_battery_stats
¶
Retrieve raw statistics from battery.
Failure of tlp_get_stats() may be non-fatal, so we just return
the message for display and let the user decide what to do.
Returns:
| Name | Type | Description |
|---|---|---|
BatteryInfo |
BatteryInfo
|
discharge status, and battery statistics or |
BatteryInfo
|
an error message. |
Source code in src/battery_boost/helper_functions.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
on_ac_power
¶
Return True if on AC power, else False.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If AC power cannot be determined. |
Source code in src/battery_boost/helper_functions.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
parse_args
¶
Parse command-line arguments and return configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argv
|
list[str]
|
List of command-line arguments. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
Config
|
(theme_dict, standard_font, small_font, scale_factor). |
Source code in src/battery_boost/helper_functions.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |