From 14c81d51d7776c6b6e065bd22d1a482903145ec2 Mon Sep 17 00:00:00 2001 From: Tommy Mattsson Date: Mon, 9 Oct 2017 10:30:03 +0200 Subject: Only show warning if charger is not plugged in --- battery-widget/battery.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua index 3a8b1b9..c23b4b9 100644 --- a/battery-widget/battery.lua +++ b/battery-widget/battery.lua @@ -10,10 +10,10 @@ local watch = require("awful.widget.watch") local PATH_TO_ICONS = "/usr/share/icons/Arc/status/symbolic/" local USERNAME = os.getenv("USER") -battery_widget = wibox.widget { +battery_widget = wibox.widget { { id = "icon", - widget = wibox.widget.imagebox, + widget = wibox.widget.imagebox, resize = false }, layout = wibox.container.margin(_, 0, 0, 3), @@ -29,8 +29,10 @@ watch( local _, status, charge_str, time = string.match(stdout, '(.+): (%a+), (%d?%d%d)%%,? ?.*') local charge = tonumber(charge_str) if (charge >= 0 and charge < 15) then - batteryType="battery-empty%s-symbolic" - show_battery_warning() + batteryType="battery-empty%s-symbolic" + if status ~= 'Charging' then + show_battery_warning() + end elseif (charge >= 15 and charge < 40) then batteryType="battery-caution%s-symbolic" elseif (charge >= 40 and charge < 60) then batteryType="battery-low%s-symbolic" elseif (charge >= 60 and charge < 80) then batteryType="battery-good%s-symbolic" -- cgit v1.2.3 From 9159497bf5d242a436e1120db87ad4ed7fea55b3 Mon Sep 17 00:00:00 2001 From: Tommy Mattsson Date: Mon, 9 Oct 2017 11:25:51 +0200 Subject: Added space between icon and number, and added % afterwards. --- brightness-widget/brightness.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua index 704d6be..d7713ce 100644 --- a/brightness-widget/brightness.lua +++ b/brightness-widget/brightness.lua @@ -18,8 +18,8 @@ local brightness_icon = wibox.widget { } brightness_widget = wibox.widget { - brightness_text, brightness_icon, + brightness_text, layout = wibox.layout.fixed.horizontal, } @@ -27,7 +27,7 @@ watch( get_brightness_cmd, 1, function(widget, stdout, stderr, exitreason, exitcode) local brightness_level = tonumber(string.format("%.0f", stdout)) - widget:set_text(brightness_level) + widget:set_text(" " .. brightness_level .. "%") end, brightness_text -) \ No newline at end of file +) -- cgit v1.2.3