From 37f4540a67b642a80d1904800425b1f70b5c4496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 10 Sep 2024 14:56:06 -0700 Subject: [PATCH] Add more symbolic battery icons (#267) --- data/icons.gresource.xml | 40 ++++++++++ data/icons/battery-0-charging.svg | 106 ++++++++++++++++++++++++++ data/icons/battery-0.svg | 28 +++++++ data/icons/battery-10-charging.svg | 61 +++++++++++++++ data/icons/battery-10.svg | 23 ++++++ data/icons/battery-100-charging.svg | 28 +++++++ data/icons/battery-100.svg | 27 +++++++ data/icons/battery-20-charging.svg | 114 ++++++++++++++++++++++++++++ data/icons/battery-20.svg | 28 +++++++ data/icons/battery-25-charging.svg | 114 ++++++++++++++++++++++++++++ data/icons/battery-25.svg | 27 +++++++ data/icons/battery-30-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-30.svg | 27 +++++++ data/icons/battery-35-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-35.svg | 27 +++++++ data/icons/battery-40-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-40.svg | 27 +++++++ data/icons/battery-45-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-45.svg | 27 +++++++ data/icons/battery-50-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-50.svg | 48 ++++++++++++ data/icons/battery-55-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-55.svg | 48 ++++++++++++ data/icons/battery-60-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-60.svg | 48 ++++++++++++ data/icons/battery-65-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-65.svg | 48 ++++++++++++ data/icons/battery-70-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-70.svg | 48 ++++++++++++ data/icons/battery-75-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-75.svg | 48 ++++++++++++ data/icons/battery-80-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-80.svg | 48 ++++++++++++ data/icons/battery-85-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-85.svg | 48 ++++++++++++ data/icons/battery-90-charging.svg | 108 ++++++++++++++++++++++++++ data/icons/battery-90.svg | 48 ++++++++++++ data/icons/battery-95-charging.svg | 112 +++++++++++++++++++++++++++ data/icons/battery-95.svg | 48 ++++++++++++ src/Services/Device.vala | 25 +++++- 40 files changed, 2724 insertions(+), 1 deletion(-) create mode 100644 data/icons/battery-0-charging.svg create mode 100644 data/icons/battery-0.svg create mode 100644 data/icons/battery-10-charging.svg create mode 100644 data/icons/battery-10.svg create mode 100644 data/icons/battery-100-charging.svg create mode 100644 data/icons/battery-100.svg create mode 100644 data/icons/battery-20-charging.svg create mode 100644 data/icons/battery-20.svg create mode 100644 data/icons/battery-25-charging.svg create mode 100644 data/icons/battery-25.svg create mode 100644 data/icons/battery-30-charging.svg create mode 100644 data/icons/battery-30.svg create mode 100644 data/icons/battery-35-charging.svg create mode 100644 data/icons/battery-35.svg create mode 100644 data/icons/battery-40-charging.svg create mode 100644 data/icons/battery-40.svg create mode 100644 data/icons/battery-45-charging.svg create mode 100644 data/icons/battery-45.svg create mode 100644 data/icons/battery-50-charging.svg create mode 100644 data/icons/battery-50.svg create mode 100644 data/icons/battery-55-charging.svg create mode 100644 data/icons/battery-55.svg create mode 100644 data/icons/battery-60-charging.svg create mode 100644 data/icons/battery-60.svg create mode 100644 data/icons/battery-65-charging.svg create mode 100644 data/icons/battery-65.svg create mode 100644 data/icons/battery-70-charging.svg create mode 100644 data/icons/battery-70.svg create mode 100644 data/icons/battery-75-charging.svg create mode 100644 data/icons/battery-75.svg create mode 100644 data/icons/battery-80-charging.svg create mode 100644 data/icons/battery-80.svg create mode 100644 data/icons/battery-85-charging.svg create mode 100644 data/icons/battery-85.svg create mode 100644 data/icons/battery-90-charging.svg create mode 100644 data/icons/battery-90.svg create mode 100644 data/icons/battery-95-charging.svg create mode 100644 data/icons/battery-95.svg diff --git a/data/icons.gresource.xml b/data/icons.gresource.xml index 35e071a2..4e55c81b 100644 --- a/data/icons.gresource.xml +++ b/data/icons.gresource.xml @@ -4,5 +4,45 @@ icons/balanced.svg icons/performance.svg icons/powersaver.svg + + icons/battery-100.svg + icons/battery-95.svg + icons/battery-90.svg + icons/battery-85.svg + icons/battery-80.svg + icons/battery-75.svg + icons/battery-70.svg + icons/battery-65.svg + icons/battery-60.svg + icons/battery-55.svg + icons/battery-50.svg + icons/battery-45.svg + icons/battery-40.svg + icons/battery-35.svg + icons/battery-30.svg + icons/battery-25.svg + icons/battery-20.svg + icons/battery-10.svg + icons/battery-0.svg + + icons/battery-100-charging.svg + icons/battery-95-charging.svg + icons/battery-90-charging.svg + icons/battery-85-charging.svg + icons/battery-80-charging.svg + icons/battery-75-charging.svg + icons/battery-70-charging.svg + icons/battery-65-charging.svg + icons/battery-60-charging.svg + icons/battery-55-charging.svg + icons/battery-50-charging.svg + icons/battery-45-charging.svg + icons/battery-40-charging.svg + icons/battery-35-charging.svg + icons/battery-30-charging.svg + icons/battery-25-charging.svg + icons/battery-20-charging.svg + icons/battery-10-charging.svg + icons/battery-0-charging.svg diff --git a/data/icons/battery-0-charging.svg b/data/icons/battery-0-charging.svg new file mode 100644 index 00000000..c7181645 --- /dev/null +++ b/data/icons/battery-0-charging.svg @@ -0,0 +1,106 @@ + +image/svg+xml diff --git a/data/icons/battery-0.svg b/data/icons/battery-0.svg new file mode 100644 index 00000000..c696a754 --- /dev/null +++ b/data/icons/battery-0.svg @@ -0,0 +1,28 @@ + +image/svg+xml diff --git a/data/icons/battery-10-charging.svg b/data/icons/battery-10-charging.svg new file mode 100644 index 00000000..9a2676f8 --- /dev/null +++ b/data/icons/battery-10-charging.svg @@ -0,0 +1,61 @@ + +image/svg+xml diff --git a/data/icons/battery-10.svg b/data/icons/battery-10.svg new file mode 100644 index 00000000..e46dceaf --- /dev/null +++ b/data/icons/battery-10.svg @@ -0,0 +1,23 @@ + +image/svg+xml diff --git a/data/icons/battery-100-charging.svg b/data/icons/battery-100-charging.svg new file mode 100644 index 00000000..af339653 --- /dev/null +++ b/data/icons/battery-100-charging.svg @@ -0,0 +1,28 @@ + +image/svg+xml diff --git a/data/icons/battery-100.svg b/data/icons/battery-100.svg new file mode 100644 index 00000000..f8639e1b --- /dev/null +++ b/data/icons/battery-100.svg @@ -0,0 +1,27 @@ + +image/svg+xml diff --git a/data/icons/battery-20-charging.svg b/data/icons/battery-20-charging.svg new file mode 100644 index 00000000..eab6a612 --- /dev/null +++ b/data/icons/battery-20-charging.svg @@ -0,0 +1,114 @@ + +image/svg+xml diff --git a/data/icons/battery-20.svg b/data/icons/battery-20.svg new file mode 100644 index 00000000..240f31ed --- /dev/null +++ b/data/icons/battery-20.svg @@ -0,0 +1,28 @@ + +image/svg+xml diff --git a/data/icons/battery-25-charging.svg b/data/icons/battery-25-charging.svg new file mode 100644 index 00000000..e8bfa88c --- /dev/null +++ b/data/icons/battery-25-charging.svg @@ -0,0 +1,114 @@ + +image/svg+xml diff --git a/data/icons/battery-25.svg b/data/icons/battery-25.svg new file mode 100644 index 00000000..369ff755 --- /dev/null +++ b/data/icons/battery-25.svg @@ -0,0 +1,27 @@ + +image/svg+xml diff --git a/data/icons/battery-30-charging.svg b/data/icons/battery-30-charging.svg new file mode 100644 index 00000000..0f57450e --- /dev/null +++ b/data/icons/battery-30-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-30.svg b/data/icons/battery-30.svg new file mode 100644 index 00000000..0b9a2d4d --- /dev/null +++ b/data/icons/battery-30.svg @@ -0,0 +1,27 @@ + +image/svg+xml diff --git a/data/icons/battery-35-charging.svg b/data/icons/battery-35-charging.svg new file mode 100644 index 00000000..e828645a --- /dev/null +++ b/data/icons/battery-35-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-35.svg b/data/icons/battery-35.svg new file mode 100644 index 00000000..3ecc5994 --- /dev/null +++ b/data/icons/battery-35.svg @@ -0,0 +1,27 @@ + +image/svg+xml diff --git a/data/icons/battery-40-charging.svg b/data/icons/battery-40-charging.svg new file mode 100644 index 00000000..388e3e0a --- /dev/null +++ b/data/icons/battery-40-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-40.svg b/data/icons/battery-40.svg new file mode 100644 index 00000000..151f2d91 --- /dev/null +++ b/data/icons/battery-40.svg @@ -0,0 +1,27 @@ + +image/svg+xml diff --git a/data/icons/battery-45-charging.svg b/data/icons/battery-45-charging.svg new file mode 100644 index 00000000..b92b02a6 --- /dev/null +++ b/data/icons/battery-45-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-45.svg b/data/icons/battery-45.svg new file mode 100644 index 00000000..62aa2dd9 --- /dev/null +++ b/data/icons/battery-45.svg @@ -0,0 +1,27 @@ + +image/svg+xml diff --git a/data/icons/battery-50-charging.svg b/data/icons/battery-50-charging.svg new file mode 100644 index 00000000..d78d9c7d --- /dev/null +++ b/data/icons/battery-50-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-50.svg b/data/icons/battery-50.svg new file mode 100644 index 00000000..e3a1bc5b --- /dev/null +++ b/data/icons/battery-50.svg @@ -0,0 +1,48 @@ + +image/svg+xml diff --git a/data/icons/battery-55-charging.svg b/data/icons/battery-55-charging.svg new file mode 100644 index 00000000..0ff4bc87 --- /dev/null +++ b/data/icons/battery-55-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-55.svg b/data/icons/battery-55.svg new file mode 100644 index 00000000..e39469a7 --- /dev/null +++ b/data/icons/battery-55.svg @@ -0,0 +1,48 @@ + +image/svg+xml diff --git a/data/icons/battery-60-charging.svg b/data/icons/battery-60-charging.svg new file mode 100644 index 00000000..bc587451 --- /dev/null +++ b/data/icons/battery-60-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-60.svg b/data/icons/battery-60.svg new file mode 100644 index 00000000..419ea2ba --- /dev/null +++ b/data/icons/battery-60.svg @@ -0,0 +1,48 @@ + +image/svg+xml diff --git a/data/icons/battery-65-charging.svg b/data/icons/battery-65-charging.svg new file mode 100644 index 00000000..4b3467dd --- /dev/null +++ b/data/icons/battery-65-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-65.svg b/data/icons/battery-65.svg new file mode 100644 index 00000000..46d1b4af --- /dev/null +++ b/data/icons/battery-65.svg @@ -0,0 +1,48 @@ + +image/svg+xml diff --git a/data/icons/battery-70-charging.svg b/data/icons/battery-70-charging.svg new file mode 100644 index 00000000..e2af4b2b --- /dev/null +++ b/data/icons/battery-70-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-70.svg b/data/icons/battery-70.svg new file mode 100644 index 00000000..24444f55 --- /dev/null +++ b/data/icons/battery-70.svg @@ -0,0 +1,48 @@ + +image/svg+xml diff --git a/data/icons/battery-75-charging.svg b/data/icons/battery-75-charging.svg new file mode 100644 index 00000000..b9cc54f7 --- /dev/null +++ b/data/icons/battery-75-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-75.svg b/data/icons/battery-75.svg new file mode 100644 index 00000000..53b5a98c --- /dev/null +++ b/data/icons/battery-75.svg @@ -0,0 +1,48 @@ + +image/svg+xml diff --git a/data/icons/battery-80-charging.svg b/data/icons/battery-80-charging.svg new file mode 100644 index 00000000..e99dec53 --- /dev/null +++ b/data/icons/battery-80-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-80.svg b/data/icons/battery-80.svg new file mode 100644 index 00000000..0fad0aa4 --- /dev/null +++ b/data/icons/battery-80.svg @@ -0,0 +1,48 @@ + +image/svg+xml diff --git a/data/icons/battery-85-charging.svg b/data/icons/battery-85-charging.svg new file mode 100644 index 00000000..5e29d826 --- /dev/null +++ b/data/icons/battery-85-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-85.svg b/data/icons/battery-85.svg new file mode 100644 index 00000000..23f8d2fd --- /dev/null +++ b/data/icons/battery-85.svg @@ -0,0 +1,48 @@ + +image/svg+xml diff --git a/data/icons/battery-90-charging.svg b/data/icons/battery-90-charging.svg new file mode 100644 index 00000000..008e3b71 --- /dev/null +++ b/data/icons/battery-90-charging.svg @@ -0,0 +1,108 @@ + +image/svg+xml diff --git a/data/icons/battery-90.svg b/data/icons/battery-90.svg new file mode 100644 index 00000000..7f7efdc9 --- /dev/null +++ b/data/icons/battery-90.svg @@ -0,0 +1,48 @@ + +image/svg+xml diff --git a/data/icons/battery-95-charging.svg b/data/icons/battery-95-charging.svg new file mode 100644 index 00000000..1f2a0b91 --- /dev/null +++ b/data/icons/battery-95-charging.svg @@ -0,0 +1,112 @@ + +image/svg+xml diff --git a/data/icons/battery-95.svg b/data/icons/battery-95.svg new file mode 100644 index 00000000..a73198cf --- /dev/null +++ b/data/icons/battery-95.svg @@ -0,0 +1,48 @@ + +image/svg+xml diff --git a/src/Services/Device.vala b/src/Services/Device.vala index 23ea6539..fca8a600 100644 --- a/src/Services/Device.vala +++ b/src/Services/Device.vala @@ -227,7 +227,30 @@ public class Power.Services.Device : Object { } public string get_symbolic_icon_name_for_battery () { - return get_icon_name_for_battery () + "-symbolic"; + if (!is_a_battery) { + return "preferences-system-power-symbolic"; + } + + var icon_name = "battery"; + + if (percentage > 10) { + // Round to the nearest 5 percent + // Clamp to 20. There is no 15. Make sure we don't have single px red line until < 10 + var rounded_percentage = (int) (5 * Math.round (percentage / 5)).clamp (20, 100); + icon_name += "-%i".printf (rounded_percentage); + } else if (percentage > 0) { + icon_name += "-10"; + } else { + icon_name += "-0"; + } + + if (is_charging) { + icon_name += "-charging"; + } else if (time_to_empty >= 0 && time_to_empty < 15 * 60) { + icon_name = "battery-0"; + } + + return icon_name += "-symbolic"; } public string get_icon_name_for_battery () {