zsh: remove battery indicator from prompt #844

Merged
JakeHillion merged 1 commits from jj/kvnxyywvyntu into main 2026-01-02 12:46:38 +00:00
+1 -22
View File
@@ -49,28 +49,7 @@ in
source ${nix-direnv}/share/nix-direnv/direnvrc
'';
promptInit = with pkgs; if config.custom.profiles.laptop then ''
# Battery status in prompt for laptops
function battery_prompt() {
local battery_info=$(${pkgs.acpi}/bin/acpi -b 2>/dev/null | head -1)
if [ -n "$battery_info" ]; then
local percentage=$(echo "$battery_info" | ${pkgs.gnugrep}/bin/grep -oE '[0-9]+%' | head -1)
local bat_status=$(echo "$battery_info" | cut -d: -f2 | cut -d, -f1 | tr -d ' ')
local pct_num=''${percentage%%%}
if [[ "$bat_status" == "Charging" ]]; then
echo "⚡$pct_num|"
elif [ "$pct_num" -lt 20 ]; then
echo "🪫$pct_num|"
else
echo "🔋$pct_num|"
fi
fi
}
setopt PROMPT_SUBST
PROMPT='$(battery_prompt)%n@%m:%~/ > '
'' else ''
promptInit = ''
PROMPT='%n@%m:%~/ > '
'';
};