-- Icons definitions for custom widgets
local beautiful = require("beautiful")
local beautiful_assets = require("beautiful").theme_assets
local gears = require("gears")
function beautiful.recolor_icon_group(tbl,regex,color)
    for k,v in pairs(tbl) do
        if k:match(regex) then
            beautiful[k] = gears.color.recolor_image(v,color)
        end
    end
end
-- Define dir to icons
global.themes_dir = global.themes_dir or (os.getenv("HOME").."/.config/awesome/themes/")
beautiful.name = beautiful.name or "default"
beautiful.icon_dir = beautiful.icon_dir or global.themes_dir..beautiful.name.."/icons/"
local temp = {}
-- Powermenu icons
temp.powercontrol_icon_shutdown = beautiful.icon_dir.."shutdown.svg"
temp.powercontrol_icon_suspend = beautiful.icon_dir.."suspend.svg"
temp.powercontrol_icon_lock = beautiful.icon_dir.."lock.svg"
beautiful.recolor_icon_group(temp,"^powercontrol_.+",beautiful.fg_normal)


-- Volume icons
temp.volume_icon_high = beautiful.icon_dir.."volume-high.svg"
temp.volume_icon_medium = beautiful.icon_dir.."volume-medium.svg"
temp.volume_icon_low = beautiful.icon_dir.."volume-low.svg"
temp.volume_icon_muted = beautiful.icon_dir.."volume-muted.svg"
beautiful.recolor_icon_group(temp,"^volume_.+",beautiful.fg_normal)

-- Battery icons
temp.battery_caution_charging_symbolic = beautiful.icon_dir.."battery-caution-charging-symbolic.svg"
temp.battery_caution_symbolic = beautiful.icon_dir.."battery-caution-symbolic.svg"
temp.battery_empty_charging_symbolic = beautiful.icon_dir.."battery-empty-charging-symbolic.svg"
temp.battery_empty_symbolic = beautiful.icon_dir.."battery-empty-symbolic.svg"
temp.battery_full_charged_symbolic = beautiful.icon_dir.."battery-full-charged-symbolic.svg"
temp.battery_full_charging_symbolic = beautiful.icon_dir.."battery-full-charging-symbolic.svg"
temp.battery_full_symbolic = beautiful.icon_dir.."battery-full-symbolic.svg"
temp.battery_good_charging_symbolic = beautiful.icon_dir.."battery-good-charging-symbolic.svg"
temp.battery_good_symbolic = beautiful.icon_dir.."battery-good-symbolic.svg"
temp.battery_low_charging_symbolic = beautiful.icon_dir.."battery-low-charging-symbolic.svg"
temp.battery_low_symbolic = beautiful.icon_dir.."battery-low-symbolic.svg"
temp.battery_missing_symbolic = beautiful.icon_dir.."battery-missing-symbolic.svg"
beautiful.recolor_icon_group(temp,"^battery_.+",beautiful.fg_normal)

-- Widget icons
beautiful.wallpapers_icon = gears.color.recolor_image(beautiful.icon_dir.."wallpaper.svg",beautiful.fg_normal)
beautiful.mailbox_icon = gears.color.recolor_image(beautiful.icon_dir.."mail.svg",beautiful.fg_normal)
beautiful.username_logout_icon = gears.color.recolor_image(beautiful.icon_dir.."system-log-out-symbolic.svg",beautiful.fg_normal)

