From fedea487b637f4cf4cd8dd3ac7b57ff168051a59 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Tue, 24 Dec 2019 20:36:44 -0500 Subject: Check if folder with icons exists, make use of show_current_level --- battery-widget/battery.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'battery-widget') 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" -- cgit v1.2.3