Browse Source

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

张新伟 9 months ago
parent
commit
5acaa240d3
2 changed files with 8 additions and 1 deletions
  1. 7 0
      plugins/battery/README.md
  2. 1 1
      plugins/battery/battery.plugin.zsh

+ 7 - 0
plugins/battery/README.md

@@ -12,6 +12,13 @@ Then, add the `battery_pct_prompt` function to your custom theme. For example:
 RPROMPT='$(battery_pct_prompt) ...'
 ```
 
+Also, you set the `BATTERY_CHARGING` variable to your favor.
+For example:
+
+```zsh
+BATTERY_CHARGING="⚡️"
+```
+
 ## Requirements
 
 - On Linux, you must have the `acpi` or `acpitool` commands installed on your operating system.

+ 1 - 1
plugins/battery/battery.plugin.zsh

@@ -58,7 +58,7 @@ if [[ "$OSTYPE" = darwin* ]]; then
       fi
       echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
     else
-      echo ""
+      echo "${BATTERY_CHARGING-⚡️}"
     fi
   }