aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/quarrel/iconset.lua
blob: 43b7104a16c6112c6522f25de28d8a888b4a7f90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
local gstring = require "gears.string"

local M = {}

--- Generate a shim to allow indexing an iconset as a Lua table
---@param path string
---@return table
function M.new(path)
    return setmetatable({}, {
        ---@param icon string
        __index = function(self, icon)
            return path .. (gstring.endswith(path, "/") and "" or "/") .. icon:gsub("_", "-") .. ".svg"
        end,
    })
end

return setmetatable(M, {
    __call = function(_, ...)
        return M.new(...)
    end,
})