Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- batpath=/usr/share/icons/AwOkenWhite/clear/128x128/status
- acpi | grep -Eq "Charging|Full" && {
- echo -n "Plugged ";
- ext=-charging.png;
- title="Charging" ;
- Nota=$(acpi | grep -Eo "[0-9]{1,3}%");
- echo $Nota
- } || {
- acpi | grep -Eo "[0-9]{1,3}%, ([0-9]{1,2}:){1,2}([0-9]{2}){0,1}" | sed 's/, / (/g;s/:[0-9][0-9]$/\ left)/g'
- Nota=$(acpi | grep -Eo "[0-9]{1,3}%");
- ext=.png
- title="Discharging"
- }
- # Thanks to Julio Neves
- shopt -s extglob
- Faixa=$(case $Nota in
- ?([01])[0-9]%) echo 000 ;;
- [23][0-9]%) echo 020 ;;
- [45][0-9]%) echo 040 ;;
- [56][0-9]%) echo 060 ;;
- [78][0-9]%) echo 080 ;;
- *) echo 100;;
- esac) # Se seu bash for anterior ao 4.0, deve ser adicionado um abre parênteses antes de cada asterisco
- notify-send -i $batpath/gpm-battery-$Faixa$ext $title $Nota # a opção -i especifica o ícone (/usr/share/icons)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement