How to disable Bluetooth power saving?

I've been using a Bluetooth keyboard with Ubuntu for years now. To begin with it was quite tricky to get it to pair, but for the last several releases it's been rock solid.

After updating to 20.04 (from 19.10) it still works great, but it has acquired a new feature in which the keyboard goes to sleep if I don't type anything for a while. I presume this is deliberate and meant to be an improvement, and it reconnects just fine when I do press a key, but it takes a few seconds and drops any key presses in the meantime, so it's annoying.

How can I go back to the old always-connected mode, please?


Maybe try this...

The comment in /etc/bluetooth/input.conf says it should already default to '0' so this shouldn't be needed, but explicitly setting IdleTimeout to 0 like this seems to have worked for me, I am using Ubuntu 20.04

sudo sed -i 's/#IdleTimeout=30/IdleTimeout=0/g' /etc/bluetooth/input.conf