From 51be15cd7c9f39276f27d416356744041e62c22c Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 25 Jul 2025 17:03:32 +0530 Subject: Add edge decoration widgets --- TODO.org | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'TODO.org') diff --git a/TODO.org b/TODO.org index 0a6b89f..ce4cb95 100644 --- a/TODO.org +++ b/TODO.org @@ -13,6 +13,7 @@ - [ ] INVESTIGATE: Check why urlchanged doesnt fire for first url open sometimes - [ ] INVESTIGATE: Segfault on close sometimes - [ ] API's don't validate types. (type conversion segfaults) +- [ ] web.view apis in `-e` flag from "clients" (non-servers calls) don't work ** Next - [ ] Tests for window @@ -95,15 +96,26 @@ web.search.get_search_text() web.search.current() web.search.total() -web.decorations.configure('left', { - url = 'https://something.com', - size = 100, +web.decorations.top.configure({ visible = true, size = 30 }) +web.decorations.top.configure({ visible = false }) -- hide/show +local view_id = web.decorations.top.view() +web.view.set_html('
Hello world
', { view = view }) +web.decorations.top.destroy() -- Maybe to destroy unwanted webviews + +-- Show tabs in top decoration +web.view.expose_js('openTab', function(tabId) + web.view.select({ view = tabId }) +end, { view = web.decorations.top.view() }) +web.event.add_listener({ 'TabOpen', 'TabClose' }, { + callback = function() + local tabs_html = '' + local views = web.view.list() + for index, view in ipairs(web.view.list()) do + local text = index..': '..view.title..' ('..view.url..')' + local tab = '' .. text .. '') + tabs_html = tabs_html .. tab + end + web.view.set_html(tabs_html, { view = web.decorations.top.view() }) + end, }) -local sidebar_decoration = web.decorations.left() -web.decorations.delete(sidebar_decoration) -web.decorations.hide(sidebar_decoration) - -web.decorations.configure('top', { size = 28 }) -local tabline_decoration = web.decorations.top() -web.view.set_html('
Hello world
', { view_id = tabline_decoration.view_id }) #+end_src -- cgit v1.3.1