Add vcs plugin for git. Change charging icon

This commit is contained in:
Ceda EI 2019-02-16 22:27:29 +05:30
parent 17b9782056
commit 2ffe6cfd47
2 changed files with 40 additions and 2 deletions

View File

@ -10,14 +10,15 @@ function wish_battery_set_colors() {
WISH_BATTERY_FG=${WISH_BATTERY_FG:-$WISH_DEFAULT_FG} WISH_BATTERY_FG=${WISH_BATTERY_FG:-$WISH_DEFAULT_FG}
WISH_BATTERY_BG=${WISH_BATTERY_BG:-$WISH_DEFAULT_BG} WISH_BATTERY_BG=${WISH_BATTERY_BG:-$WISH_DEFAULT_BG}
WISH_BATTERY_ID=${WISH_BATTERY_ID:-BAT0} WISH_BATTERY_ID=${WISH_BATTERY_ID:-BAT0}
WISH_BATTERY_CHARGING=${WISH_BATTERY_CHARGING:-} WISH_BATTERY_CHARGING=${WISH_BATTERY_CHARGING:-ϟ}
WISH_BATTERY_DISCHARGING=${WISH_BATTERY_DISCHARGING:-} WISH_BATTERY_DISCHARGING=${WISH_BATTERY_DISCHARGING:-}
} }
function wish_battery_main() { function wish_battery_main() {
local path=/sys/class/power_supply/$WISH_BATTERY_ID local path=/sys/class/power_supply/$WISH_BATTERY_ID
local battery=$(($(cat $path/charge_now) * 100 / $(cat $path/charge_full)))% local battery=$(($(cat $path/charge_now) * 100 / $(cat $path/charge_full)))%
if [[ $(cat $path/status) == "Charging" ]]; then if [[ $(cat $path/status) == "Charging" ]] ||
[[ $(cat $path/status) == "Full" ]]; then
battery="$WISH_BATTERY_CHARGING $battery" battery="$WISH_BATTERY_CHARGING $battery"
else else
battery="$WISH_BATTERY_DISCHARGING $battery" battery="$WISH_BATTERY_DISCHARGING $battery"

37
plugins/vcs.sh Normal file
View File

@ -0,0 +1,37 @@
function wish_vcs_start() {
return 0
}
function wish_vcs_end() {
return 0
}
function wish_vcs_set_colors() {
WISH_VCS_FG=${WISH_VCS_FG:-$WISH_DEFAULT_FG}
WISH_VCS_BG=${WISH_VCS_BG:-$WISH_DEFAULT_BG}
WISH_VCS_GIT_SYMBOL=${WISH_VCS_GIT:-}
WISH_VCS_DEFAULT=${WISH_VCS_DEFAULT:-$}
WISH_VCS_GIT_UNTRACKED_SYMBOL=${WISH_VCS_GIT_UNTRACKED_SYMBOL:-}
}
function wish_vcs_main() {
local op=$(git diff --numstat HEAD 2> /dev/null)
if [[ $op != "" ]]; then
local git
if [[ $(git status --porcelain 2> /dev/null | grep "^??") != "" ]]; then
local git=" $WISH_VCS_GIT_UNTRACKED_SYMBOL"
fi
git="$git $WISH_VCS_GIT_SYMBOL "
git="$git$(git branch | grep -F \* | sed 's/\* //') "
local add=$(echo "$op" | awk '{a += $1} END {print a}')
local del=$(echo "$op" | awk '{d += $2} END {print d}')
if [[ $add != 0 ]] && [[ $del != 0 ]]; then
git="$git+$add -$del "
fi
wish_append $WISH_VCS_BG $WISH_VCS_FG "$git"
else
wish_append $WISH_VCS_BG $WISH_VCS_FG " $WISH_VCS_DEFAULT "
fi
}