From f0ad918feb5488a7921a3d2eb907e0a8bfaab969 Mon Sep 17 00:00:00 2001 From: Michael Aquilina Date: Sat, 24 Aug 2019 17:44:29 +0100 Subject: [PATCH] Add waybar-battery(5) --- meson.build | 1 + waybar-backlight.5.scd | 2 +- waybar-battery.5.scd | 121 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 waybar-battery.5.scd diff --git a/meson.build b/meson.build index 5677bac7..c3314d9b 100644 --- a/meson.build +++ b/meson.build @@ -162,6 +162,7 @@ if scdoc.found() man_files = [ 'waybar.5.scd', 'waybar-backlight.5.scd', + 'waybar-battery.5.scd', ] foreach filename : man_files diff --git a/waybar-backlight.5.scd b/waybar-backlight.5.scd index 19925581..765bd8cc 100644 --- a/waybar-backlight.5.scd +++ b/waybar-backlight.5.scd @@ -65,4 +65,4 @@ The *backlight* module displays the current backlight level. # Style -- `#backlight` +- *#backlight* diff --git a/waybar-battery.5.scd b/waybar-battery.5.scd new file mode 100644 index 00000000..08a9432b --- /dev/null +++ b/waybar-battery.5.scd @@ -0,0 +1,121 @@ +waybar-battery(5) + +# NAME + +waybar - battery module + +# DESCRIPTION + +The *battery* module displays the current capacity and state (eg. charging) of your battery. + +*bat* ++ + typeof: string ++ + The battery to monitor, as in /sys/class/power_supply/ instead of auto detect. + +*adapter* ++ + typeof: string ++ + The adapter to monitor, as in /sys/class/power_supply/ instead of auto detect. + +*interval* ++ + typeof: integer ++ + default: 60 ++ + The interval in which the information gets polled. + +*states* ++ + typeof: array ++ + A number of battery states which get activated on certain capacity levels. See *waybar-states(5)*. + +*format* ++ + typeof: string ++ + default: {capacity}% ++ + The format, how the time should be displayed. + +*format-icons* + typeof: array/object + Based on the current capacity, the corresponding icon gets selected. ++ + The order is *low* to *high*. Or by the state if it is an object. + +*max-length* ++ + typeof: integer++ + The maximum length in character the module should display. + +*rotate* ++ + typeof: integer++ + Positive value to rotate the text label. + +*on-click* ++ + typeof: string ++ + Command to execute when clicked on the module. + +*on-click-right* ++ + typeof: string ++ + Command to execute when you right clicked on the module. + +*on-scroll-up* ++ + typeof: string ++ + Command to execute when scrolling up on the module. + +*on-scroll-down* ++ + typeof: string ++ + Command to execute when scrolling down on the module. + +*smooth-scrolling-threshold* ++ + typeof: double ++ + Threshold to be used when scrolling. + +*tooltip* ++ + typeof: bool ++ + default: true ++ + Option to disable tooltip on hover. + +# Format Replacements: + +*{capacity}*: Capacity in percentage + +*{icon}*: Icon, as defined in *format-icons*. + +*{time}*: Estimate of time until full or empty. Note that this is based on the power draw at the last refresh time, not an average. + +# Custom Formats: + +The *battery* module allows to define custom formats based on up to two factors. The best fitting format will be selected. + +*format-*: With *states*, a custom format can be set depending on the capacity of your battery. + +*format-*: With the status, a custom format can be set depending on the status in /sys/class/power_supply//status (in lowercase). + +*format--*: You can also set a custom format depending on both values. + +# States: + +- Every entry (*state*) consists of a ** (typeof: *string*) and a ** (typeof: *integer*). + - The state can be addressed as a CSS class in the *style.css*. The name of the CSS class is the ** of the state. Each class gets activated when the current capacity is equal or below the configured **. + - Also each state can have its own *format*. Those con be configured via *format-*. Or if you want to differentiate a bit more even as *format--*. For more information see *custom-formats*. + + + +# Example: + +``` +"battery": { + "bat": "BAT2", + "interval": 60, + "states": { + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-icons": ["", "", "", "", ""], + "max-length": 25 +} +``` + +# Style + +- *#battery* +- *#battery.* + - ** is the value of /sys/class/power_supply//status in lowercase. +- *#battery.* + - ** can be defined in the *config*. For more information see *states*. +- *#battery..* + - Combination of both ** and **.