From be5162cc6a9756905bba59134c3cb822473fef90 Mon Sep 17 00:00:00 2001 From: Jessie Hildebrandt Date: Sun, 4 Feb 2018 07:26:27 +0000 Subject: [PATCH] Add battery status reporting to prompt --- config.fish | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/config.fish b/config.fish index 1b265c0..945f11c 100644 --- a/config.fish +++ b/config.fish @@ -22,12 +22,24 @@ function fish_prompt --description 'Write out the prompt' # Color Definitions set -l normal_color (set_color normal) + set -l bat_color (set_color bryellow) set -l usr_color (set_color brgreen) set -l dir_color (set_color brblue) set -l vcs_color (set_color brblack) set -l err_color (set_color red) + # Battery File Location +# set -l bat_file DISABLED + set -l bat_file /sys/class/power_supply/BAT0/capacity + + # Battery Status Formatting + set -l bat_status "" + if test -f $bat_file + set -l bat_capacity (cat $bat_file) + set bat_status "$bat_color" "$bat_capacity" "%" "$normal_color" " " + end + # User/Hostname Formatting set -l user_host $usr_color $USER "@" (hostname -s) "$normal_color" @@ -49,10 +61,10 @@ function fish_prompt --description 'Write out the prompt' # Exit Status Formatting set -l prompt_status if test $last_status -ne 0 - set prompt_status " " "$err_color" "[$last_status]" "$normal_color" + set prompt_status " " "$err_color" "[$last_spptatus]" "$normal_color" end # Print Prompt - echo -n -s $user_host " " $current_dir $vcs_status $prompt_status $suffix " " + echo -n -s $bat_status $user_host " " $current_dir $vcs_status $prompt_status $suffix " " -end \ No newline at end of file +end