summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Makhov <pmakhov@theoctavegroup.com>2019-12-24 20:36:44 -0500
committerPavel Makhov <pmakhov@theoctavegroup.com>2019-12-24 20:36:44 -0500
commitfedea487b637f4cf4cd8dd3ac7b57ff168051a59 (patch)
treeeaffa07f04610c4f9f947573bd035e5fc3e269fc
parentbc3fe1e31f2e0962214435c1e7647d87820e60d1 (diff)
Check if folder with icons exists, make use of show_current_level
-rw-r--r--battery-widget/battery.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua
index d5e339f..ae7f9e7 100644
--- a/battery-widget/battery.lua
+++ b/battery-widget/battery.lua
@@ -12,6 +12,7 @@ local awful = require("awful")
local naughty = require("naughty")
local watch = require("awful.widget.watch")
local wibox = require("wibox")
+local gfs = require("gears.filesystem")
local dpi = require('beautiful').xresources.apply_dpi
-- acpi sample outputs
@@ -38,7 +39,15 @@ local function worker(args)
local warning_msg_position = args.warning_msg_position or 'bottom_right'
local warning_msg_icon = args.warning_msg_icon or HOME .. '/.config/awesome/awesome-wm-widgets/batteryarc-widget/spaceman.jpg'
- icon_widget = wibox.widget {
+ if not gfs.dir_readable(PATH_TO_ICONS) then
+ naughty.notify{
+ title = "Battery Widget",
+ text = "Folder with icons doesn't exist: " .. PATH_TO_ICONS,
+ preset = naughty.config.presets.critical
+ }
+ end
+
+ local icon_widget = wibox.widget {
{
id = "icon",
widget = wibox.widget.imagebox,
@@ -134,7 +143,9 @@ local function worker(args)
end
charge = charge / capacity
- level_widget.text = string.format('%d%%', charge)
+ if show_current_level then
+ level_widget.text = string.format('%d%%', charge)
+ end
if (charge >= 0 and charge < 15) then
batteryType = "battery-empty%s-symbolic"