diff options
author | Kevin <[email protected]> | 2024-10-15 02:57:27 -0300 |
---|---|---|
committer | Kevin <[email protected]> | 2024-10-15 02:57:27 -0300 |
commit | 03f2c4706faba7dac5aee71b10255eac218cbeec (patch) | |
tree | ebb624a9e058653891713ed8a6b199b5e31652ea /examples/lua/notification-popups/lib.lua | |
parent | ea6b3e6b24ced559c33b5f7df3fdd138409491d3 (diff) |
revert example-lua commit
Diffstat (limited to 'examples/lua/notification-popups/lib.lua')
-rw-r--r-- | examples/lua/notification-popups/lib.lua | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/examples/lua/notification-popups/lib.lua b/examples/lua/notification-popups/lib.lua deleted file mode 100644 index 2ae71a9..0000000 --- a/examples/lua/notification-popups/lib.lua +++ /dev/null @@ -1,52 +0,0 @@ -local Variable = require("astal").Variable -local astal = require("astal") -local Gtk = astal.Gtk - -local M = {} - -function M.src(path) - local str = debug.getinfo(2, "S").source:sub(2) - local src = str:match("(.*/)") or str:match("(.*\\)") or "./" - return src .. path -end - ----@generic T, R ----@param arr T[] ----@param func fun(T, integer): R ----@return R[] -function M.map(arr, func) - local new_arr = {} - for i, v in ipairs(arr) do - new_arr[i] = func(v, i) - end - return new_arr -end - ----@param name string ----@param size? 16 | 32 | 64 | 128 | 256 | 512 | number -function M.lookup_icon(name, size) - if not name or #name == 0 then - return - end - size = size or 256 - - local theme = Gtk.IconTheme.get_default() - local icon_info, path - - for _, n in ipairs({ - name, - string.lower(name), - string.upper(name), - }) do - icon_info = theme:lookup_icon(n, size, "USE_BUILTIN") - - if icon_info then - return icon_info - end - end - return false -end - -M.date = Variable(""):poll(1000, "date") - -return M |