5acaa240d3dde98f2bc2354ad6201e6954254b2c

Author
张新伟 <me@ryuujo.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(battery): support custom AC indicator (#12528)

Diff

 1diff --git a/plugins/battery/README.md b/plugins/battery/README.md
 2index 18e5bd882702fc4049de8fc193b8e34d19c176b6..73fcb693e625aa90a9906515266308c7f3510245 100644
 3--- a/plugins/battery/README.md
 4+++ b/plugins/battery/README.md
 5@@ -12,6 +12,13 @@ Then, add the `battery_pct_prompt` function to your custom theme. For example:
 6 RPROMPT='$(battery_pct_prompt) ...'
 7 ```
 8 
 9+Also, you set the `BATTERY_CHARGING` variable to your favor.
10+For example:
11+
12+```zsh
13+BATTERY_CHARGING="⚡️"
14+```
15+
16 ## Requirements
17 
18 - On Linux, you must have the `acpi` or `acpitool` commands installed on your operating system.
19diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
20index 1d3d529a319e9f166ba32e6cf2bc0ec07bb21f6c..7977e4d045e8938c31889c01acf6de6a7f34c787 100644
21--- a/plugins/battery/battery.plugin.zsh
22+++ b/plugins/battery/battery.plugin.zsh
23@@ -58,7 +58,7 @@ if [[ "$OSTYPE" = darwin* ]]; then
24       fi
25       echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
26     else
27-      echo "∞"
28+      echo "${BATTERY_CHARGING-⚡️}"
29     fi
30   }
31