From 2994d0efa0e6d4f05be7660a0240bf5610071d52 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Fri, 9 Nov 2018 18:19:05 +0100 Subject: [PATCH] [modules/battery] Better display for "unknown" charge status Some laptops, such as Dells, may display an unknown charge state when the battery is attached to a docking station, but discharging (because of configuration settings for longevity of the battery). Show that nicer. --- bumblebee/modules/battery.py | 2 +- themes/icons/ascii.json | 6 +++++- themes/icons/awesome-fonts.json | 7 ++++++- themes/icons/ionicons.json | 5 +++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bumblebee/modules/battery.py b/bumblebee/modules/battery.py index bdd21ef..4174e56 100644 --- a/bumblebee/modules/battery.py +++ b/bumblebee/modules/battery.py @@ -109,7 +109,7 @@ class Module(bumblebee.engine.Module): if charge == "Discharging": state.append("discharging-{}".format(min([10, 25, 50, 80, 100], key=lambda i: abs(i-capacity)))) elif charge == "Unknown": - state.append("unknown") + state.append("unknown-{}".format(min([10, 25, 50, 80, 100], key=lambda i: abs(i-capacity)))) else: if capacity > 95: state.append("charged") diff --git a/themes/icons/ascii.json b/themes/icons/ascii.json index 547e764..ca20d5f 100644 --- a/themes/icons/ascii.json +++ b/themes/icons/ascii.json @@ -49,7 +49,11 @@ "discharging-25": { "suffix": "dis" }, "discharging-50": { "suffix": "dis" }, "discharging-80": { "suffix": "dis" }, - "discharging-100": { "suffix": "dis" } + "discharging-100": { "suffix": "dis" }, + "unknown-25": { "suffix": "?" }, + "unknown-50": { "suffix": "?" }, + "unknown-80": { "suffix": "?" }, + "unknown-100": { "suffix": "?" } }, "caffeine": { "activated": {"prefix": "caf-on" }, "deactivated": { "prefix": "caf-off " } diff --git a/themes/icons/awesome-fonts.json b/themes/icons/awesome-fonts.json index 8b20e18..ed84f6d 100644 --- a/themes/icons/awesome-fonts.json +++ b/themes/icons/awesome-fonts.json @@ -88,7 +88,12 @@ "discharging-80": { "prefix": "", "suffix": "" }, "discharging-100": { "prefix": "", "suffix": "" }, "unlimited": { "prefix": "", "suffix": "" }, - "estimate": { "prefix": "" } + "estimate": { "prefix": "" }, + "unknown-10": { "prefix": "", "suffix": "" }, + "unknown-25": { "prefix": "", "suffix": "" }, + "unknown-50": { "prefix": "", "suffix": "" }, + "unknown-80": { "prefix": "", "suffix": "" }, + "unknown-100": { "prefix": "", "suffix": "" } }, "caffeine": { "activated": {"prefix": " " }, diff --git a/themes/icons/ionicons.json b/themes/icons/ionicons.json index 10b2d6f..0c6a632 100644 --- a/themes/icons/ionicons.json +++ b/themes/icons/ionicons.json @@ -84,6 +84,11 @@ "discharging-50": { "prefix": "\uf115", "suffix": "\uf3e6" }, "discharging-80": { "prefix": "\uf114", "suffix": "\uf3e6" }, "discharging-100": { "prefix": "\uf113", "suffix": "\uf3e6" }, + "unknown-10": { "prefix": "\uf112", "suffix": "\uf3bc" }, + "unknown-25": { "prefix": "\uf115", "suffix": "\uf142" }, + "unknown-50": { "prefix": "\uf115", "suffix": "\uf142" }, + "unknown-80": { "prefix": "\uf114", "suffix": "\uf142" }, + "unknown-100": { "prefix": "\uf113", "suffix": "\uf142" }, "unlimited": { "prefix": "\uf402", "suffix": "\uf493" }, "estimate": { "prefix": "\uf402" } },