adde battery and archlinux plugin

This commit is contained in:
Benjamin Martinez 2011-04-08 19:35:05 -07:00
commit 45e7a2fce4
3 changed files with 152 additions and 0 deletions

View file

@ -0,0 +1,57 @@
##some functions
###############
##--Daemons--##
###############
# starts, stops, restarts and check status of daemons
dstart() {
for arg in $@
do
sudo /etc/rc.d/$arg start
done
}
dstop() {
for arg in $@
do
sudo /etc/rc.d/$arg stop
done
}
drestart() {
for arg in $@
do
sudo /etc/rc.d/$arg restart
done
}
dstatus() {
for arg in $@
do
sudo /etc/rc.d/$arg status
done
}
###Alias
## checks if pacman-color is installed
## pcman var is needed because for some reason using pacman-color with sudo in an alias doesnt work
if which pacman-color &>/dev/null; then
pcman='pacman-color'
else
pcman='pacman'
fi
alias pacman='$pcman'
alias pacupd='_ $pcman -Syu' ##syncs and updates
alias pacser='$pcman -Ss' ##search repos for pkgs
alias pacins='_ $pcman -S' ##install pkgs
alias pacinf='$pcman -Qi' ##info of installed pkgs
alias paciss='$pcman -Qs' ##search installed pkgs
alias pacrm='_ $pcman -R' ##uninstalls pkgs
alias pacrmd='_ $pcman -Rs' ##remove a package and deps which are not required by any other installed package
alias pacrma='_ $pcman -Rsn' ##remove a package and deps and .pacsave files
alias pacclc='_ S $pcman -Scc' ## cleans pkgs cache and repos db
##makepkg alias
alias mksource='makepkg --source -f'
alias mkp='makepkg -sf ;alert'
alias mkpi='makepkg -sfi '
alias mkall='makepkg -sf && makepkg --source -f '
alias mkalli='makepkg -sfi && makepkg --source -f '

View file

@ -0,0 +1,59 @@
#!/bin/sh
##defining path of battery
if [ -e /proc/acpi/battery/BAT0/ ]
then
battpath="/proc/acpi/battery/BAT0"
elif [ -e /proc/acpi/battery/BAT1/ ]
then
battpath="/proc/acpi/battery/BAT1"
else
echo "No battery found. Make sure that you have acpi support in your kernel"
echo "and that the computer actually is a laptop :)"
exit 1
fi
batt_prompt_perc(){
fullcap=`grep "^last full capacity" $battpath/info | awk '{ print $4 }'`
remcap=`grep "^remaining capacity" $battpath/state | awk '{ print $3 }'`
charge=$(( $remcap * 100 / $fullcap ))
# prevent a charge of more than 100% displaying
if [ "$charge" -gt "99" ]
then
charge=100
fi
color="red"
if [ $charge -gt "80" ]
then
color="cyan"
elif [ $charge -gt 60 ]
then
color="green"
elif [ $charge -gt 25 ]
then
color="yellow"
fi
echo -e "%F{$color}$charge%f"
}
bat_prompt_acstt(){
batstate=`grep "^charging state" $battpath/state | awk '{ print $3 }'`
case "${batstate}" in
'charged')
clr="green"
btst="°"
;;
'charging')
clr="blue"
btst="+"
;;
'discharging')
clr="yellow"
btst="-"
;;
esac
echo -e "%F{$clr}$btst%f"
}

36
themes/cruznick.zsh-theme Normal file
View file

@ -0,0 +1,36 @@
prompt_char() {
git branch >/dev/null 2>/dev/null && echo "%F{cyan}±%f" && return
hg root >/dev/null 2>/dev/null && echo "%F{cyan}☿%f" && return
}
custom_prompt_info() {
git branch >/dev/null 2>/dev/null && echo "$(git_prompt_info)%F{green}--%f[$(git_prompt_status)]" && return
hg root >/dev/null 2>/dev/null && hg prompt "{ on {branch}}{ at {bookmark}}{status}" 2> /dev/null && return
}
command_succes() {
if [ $? = 0 ]
then
echo "%F{yellow}^_^%f"
else
echo "%F{red}O_O%f"
fi
}
PROMPT='┌[%F{green}%3c%f] $(custom_prompt_info)
%F{white}└%f %F{green}%#%f >> '
RPROMPT='$(command_succes) $(batt_prompt_perc)$(bat_prompt_acstt) $(prompt_char)'
ZSH_THEME_GIT_PROMPT_PREFIX="[%F{yellow}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%f]"
ZSH_THEME_GIT_PROMPT_DIRTY=" %F{red}*%f"
ZSH_THEME_GIT_PROMPT_CLEAN=" %F{green}°%f"
ZSH_THEME_GIT_PROMPT_ADDED="%F{green}+%f"
ZSH_THEME_GIT_PROMPT_MODIFIED="%F{blue}*%f"
ZSH_THEME_GIT_PROMPT_DELETED="%F{red}x%f"
ZSH_THEME_GIT_PROMPT_RENAMED="%F{magenta}->%f"
ZSH_THEME_GIT_PROMPT_UNMERGED="%F{yellow}═%f"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%F{cyan}?%f"