noctalia-plugin: bar widget, toolbar panel and tile, with Luau tests and a flake check
This commit is contained in:
1 parent
c8626dbe3e
commit
127d44040e
15 files changed
+530
No files matched your search
@@ -0,0 +1,36 @@
|
||||
--!nonstrict
|
||||
-- valw bar widget: a camera glyph. Left click opens the toolbar panel,
|
||||
-- right click takes a region shot at once (plain `valw region`, like the
|
||||
-- keybind: the toolbar's timer and options don't apply).
|
||||
|
||||
local PANEL = "elars/valw:toolbar"
|
||||
|
||||
local function lastLine(text)
|
||||
local last = ""
|
||||
for line in string.gmatch(text or "", "[^\n]+") do
|
||||
last = line
|
||||
end
|
||||
return last
|
||||
end
|
||||
|
||||
-- Exit 3 is a cancel (Esc): not an error.
|
||||
local function report(result)
|
||||
if result.exitCode ~= 0 and result.exitCode ~= 3 then
|
||||
noctalia.notifyError("valw", lastLine(result.stderr))
|
||||
end
|
||||
end
|
||||
|
||||
function update()
|
||||
barWidget.render(ui.row({ align = "center" }, {
|
||||
ui.glyph({ name = "camera" }),
|
||||
}))
|
||||
barWidget.setTooltip(noctalia.tr("bar.tooltip"))
|
||||
end
|
||||
|
||||
function onClick()
|
||||
noctalia.togglePanel(PANEL)
|
||||
end
|
||||
|
||||
function onRightClick()
|
||||
noctalia.runAsync("valw region", report)
|
||||
end
|
||||
Reference in new issue
Block a user