NOTE: This answer had been edited majorly, introducing significant semantical changes:
Assumedly valid for both Ubuntu 18.04 and 20.04:
The default Gnome Settings app offers blanking the screen, switching off bluetooth and wifi to save battery power, and auto-suspending when idle, in the range from 15 mins to 2 hours.
GUI for advanced battery-management options:
I don't know where is the GUI for adjusting the below discussed settings. What I mean is, it might got nuked, which is a trend these years with the default Ubuntu experience (Gnome 3 desktop).
Where are the actual configs:
Battery-related settings now exist redundantly in the system, which is highly misleading.
With that said, they are probably in
/etc/UPower/UPower.conf, as pointed out by @hackerb9 (thanks for the find, @lucidbrot)
Additionally, they are present among the system-wide application settings, accessed via the gsettings API, exposed by the optionally installable application,
Those ones in gsettings are organized in the
org.gnome.settings-daemon.plugins.power namespace, and apparently they do not take effect.
I take this from the above linked answer by @hackerb9, plus the telling comment section under this blog article.
(Actually, some settings in that gsettigs namespace keep taking effect, just not the ones that are introduced below.)
What can be configured:
There is a choice whether one wants to work in terms of battery level percentage or in terms of remaining time (gsettings default: time, UPower.conf default setting: percentage).
The following can be configured as both percentages and remaining time, both in UPower.conf and in gsettings, defaults being the same among them:
- from where it is considered low (default: 10% or 1200secs)
- from where it is considered critical (default: 3% or 300secs)
- level at which an automatic action is taken (default: 2% or 120secs)
Critical battery action choices in UPower.conf:
hybridSleep | hibernate | shutdown (default: hybridSleep, with fallback to the other options)
Critical battery action choices in gsettings:
suspend | hibernate | shutdown | and other options (default: suspend)
Worth repeating, it's likely the ones in gsettings do not play a part any more.
Now for another thing to ponder over: the
UPower.conf file starts with the following comment:
Only the system vendor should modify this file, ordinary users should
not have to change anything.
Ubuntu Help on power/battery topic
(apparently for 20.10, in other words Gnome 3 (shared by 18.04)):
Battery care via additional software:
This article commends TLP for 18.04 and higher.
TLP is well-discussed on this forum. It seems to have pretty fine-grained settings for when to start and when to stop charging, but these settings are vendor-specific (IBM/Lenovo ThinkPad, when additional dependencies are met).
Battery care via BIOS:
If you primarily use your computer with the AC adapter attached and only infrequently use battery power
In my Dell laptop's BIOS menu, there is a dedicated checkbox for exactly this use case. IIRC it's not being explained, how Dell will protect the battery, but the presence of this checkbox suggests that they are doing something differently then. So also take a good look around in your BIOS menu.
A relevant admission:
Perhaps I should have checked the aforementioned kept-on-charger BIOS checkbox, because that was my use case too. But I found it too late.
So, possibly - but not proven - due to this after 4 years, my battery has swollen to double its original thickness, and had to be removed. Due to this, right now I can't test or confirm any battery-related behaviour.