aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/quarrel/iconset.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/awesome/quarrel/iconset.lua')
-rw-r--r--.config/awesome/quarrel/iconset.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/.config/awesome/quarrel/iconset.lua b/.config/awesome/quarrel/iconset.lua
new file mode 100644
index 0000000..43b7104
--- /dev/null
+++ b/.config/awesome/quarrel/iconset.lua
@@ -0,0 +1,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,
+})