By default in Ubuntu the battery discharge notification was set based on remaining time. The remaining time was never accurate nor even near of prediction which caused sudden shutdown or hibernate while working. The only work around the internet was suggesting was to set the notification for percentage of battery remaining instead of time remaining.
Setting notification for percentage remaining.
Since these settings are in Dconf, we may need dconf-editor to makes this easier. I have explained how to install dconf-editor in Ubuntu : Add applications to system tray blog post.
After installing open the dconf editor and navigate to following path in tree sidebar.
org -> gnome -> settings-demon -> plugins -> power
, or you can try to find “battery” and reach the same.
Then update the following settings,
critical-battery-action : The default action to take when battery is empty. Set the critical-battery-action to hibernate if available.
percentage-action : At what percentage of battery OS should take the default which is set just before. I set it to 5.
percentage-critical : At what percentage of battery you need to get the critical notification. I set it to 10.
percentage-low : At what percentage of battery you need to get the first notification for battery low. I set it to 20.
use-time-for-policy : Uncheck the checkbox.
Thats it. you are done. You can either restart the system or logout and login back for the changes to take effect.
Unit next time.