fossfreedom / indicator-sysmonitor

Ayatana application indicator to show various system parameters - Debian and Ubuntu
GNU General Public License v3.0
721 stars 99 forks source link

add battery checker #30

Open fossfreedom opened 9 years ago

fossfreedom commented 9 years ago

would be more than useful to have two battery level sensors

One that monitors if the battery reaches below a given percentage before using notify-send to warn

One that monitors if the battery reaches above a given percentage before using notify-send to warn

above has a good example of how to use upower to get the value

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/24954334-add-battery-checker?utm_campaign=plugin&utm_content=tracker%2F1443743&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1443743&utm_medium=issues&utm_source=github).
ghost commented 9 years ago

@fossfreedom I have wrote a bash script but it requires acpi to be installed

fossfreedom commented 9 years ago

sounds interesting - any chance you can copy and paste the contents of the bash script here?

ghost commented 9 years ago

@fossfreedom this is the code

#!/bin/bash
#Battery level
var=$(acpi -V| awk -F',' 'NR==1, /Battery 0:/ {print $2}'); 
# Temperature
#var=$(acpi -V| awk -F',' '/Thermal 0: ok, / {print $2}'); 
echo $var

For notifiying we have to simply use a conditional statement like if and use zenity message code or notify-send

fossfreedom commented 8 years ago

looks like from this that the battery values can be obtained directly from /sys/ without any need for installing extra packages:

ghost commented 8 years ago

@fossfreedom Cool man, are you gonna add this function in your new release or we users have to add it ourselves. I have no python skills and have no idea how to use this information.