fish: repaint after battery function

This commit is contained in:
Charles Gould 2020-06-09 18:12:50 -05:00
parent 34acfe5d93
commit d682d6aa90

View File

@ -1,9 +1,7 @@
function battery --description "Print battery status"
if test (uname -s) != Darwin
echo "Unsupported kernel: "(uname -s)
return 1
end
else
set --local battery_status (pmset -g batt | string split0)
set --local battery_charge (echo $battery_status | rg --only-matching "\d+%")
set --local power_source (echo $battery_status | rg --only-matching "[A-Za-z]+\sPower")
@ -11,5 +9,9 @@ function battery --description "Print battery status"
set_color green
echo "⚡️ Running on $power_source with $battery_charge charge"
set_color normal
end
# Repaint is needed since there is a keybinding for this function
# See fish_user_key_bindings.fish
commandline -f repaint
end