Sometimes my charger remains plugged into laptop even after charging is complete.
Is there a way to get a pop-up message/notification when my battery gets full due to charging or is there any software/package which can provide the functionality?
Sometimes my charger remains plugged into laptop even after charging is complete.
Is there a way to get a pop-up message/notification when my battery gets full due to charging or is there any software/package which can provide the functionality?
I have written a small script that will do that:
Script:
Installation:
Run:
Copy the script to
~/bin
folder (why the ~/bin folder?) :Or copy it to
/usr/local/bin
if you want it to be available for all users on your computer:Then add
batteryfull.sh
script as a startup application by:Click Add and fill in as follows:
Install the
acpi
package. Now put this inreturn0whencharging.sh
and make it executable:If
echo -e "\a"
makes a sound, start this when you want to watch the battery status:If it doesn't make any sound or you want a notification and a better alarm than whatever watch can provide, install
libnotify-bin
andmpv
and use this instead:Explanation:
If you look at the man page for grep you can see that
-v
reverses the matching, and therefore the return/status code.-E
means it's a regular expression. the[\t ]
in the regex (regular expression) means "tab or space". The following star makes it mean "tab or space 0 or more times". The trailing "$" means that it should match the end of the line. The finalgrep
means that lines NOT ending in a ":", any number of tabs or spaces and then "charging" and the end of the line should makegrep
exit with status code 0. This means thatgrep
will return 1 as long as the computer is charging. Theif
will execute it's first branch when the status code is 0, which means we are effectively negating the result ofgrep
, since weexit 1
when grep exits 0 andexit 0
when grep exists non-zero.Here is the Crontab that I use
Notify if battery is full (equal to 100%)
Notify if battery is low (less than or equal to 10%)
Example Notification Image:
I was looking for the same thing and found this extension and it works as expected.