Factor out power management UI code into library

3 jobs for !1539 with dont-kill-me-lib in 9 minutes and 21 seconds (queued for 3 seconds)
latest merge request