From 7e6ca328734f1e3ed05440a064b78bd0133dd7eb Mon Sep 17 00:00:00 2001 From: Yocraft-2000 <304616174+Yocraft-2000@users.noreply.github.com> Date: Mon, 3 Aug 2026 22:04:02 +0200 Subject: [PATCH 1/5] feat(QoL): idle status with generate button off --- qrcode/panel.luau | 5 +++-- qrcode/translations/en.json | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/qrcode/panel.luau b/qrcode/panel.luau index 0e9e53c..bbab2b4 100644 --- a/qrcode/panel.luau +++ b/qrcode/panel.luau @@ -6,6 +6,7 @@ local status = "idle" local imageSize = 400 +local generateButton = noctalia.getConfig("generate_button") local notifyConf = noctalia.getConfig("notify") local function notify(text, error) @@ -23,7 +24,7 @@ local function statusText() elseif status == "copied" then return noctalia.tr("panel.status.copied") else - return noctalia.tr("panel.status.idle") + return noctalia.tr(generateButton and "panel.status.idle" or "panel.status.idlebis") end end @@ -38,7 +39,7 @@ local function render() }) } - if noctalia.getConfig("generate_button") then + if generateButton then table.insert( rowContent, ui.button({ diff --git a/qrcode/translations/en.json b/qrcode/translations/en.json index cd54f30..225fc3d 100644 --- a/qrcode/translations/en.json +++ b/qrcode/translations/en.json @@ -50,7 +50,8 @@ "error": "Error: {message}", "ready": "QR code ready. Scan it here or click it to copy.", "copied": "QR code copied to clipboard.", - "idle": "Enter some text, then press Generate." + "idle": "Enter some text, then press Generate.", + "idlebis": "Enter some text, then press Enter." }, "error": { "generate_failed": "failed to generate the QR code.", From 68a563b86277799b86329daf297ddb383e7cbd80 Mon Sep 17 00:00:00 2001 From: Yocraft-2000 <304616174+Yocraft-2000@users.noreply.github.com> Date: Mon, 3 Aug 2026 22:06:04 +0200 Subject: [PATCH 2/5] update: bump version --- qrcode/plugin.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qrcode/plugin.toml b/qrcode/plugin.toml index 00e7e8e..452bd9c 100644 --- a/qrcode/plugin.toml +++ b/qrcode/plugin.toml @@ -1,6 +1,6 @@ id = "yocraft/qrcode" name = "QR Code Encoder" -version = "1.0.0" +version = "1.0.1" plugin_api = 15 author = "yocraft" license = "MIT" From a490b350683832b7a227cb8edef86348c7bb8257 Mon Sep 17 00:00:00 2001 From: Yocraft-2000 <304616174+Yocraft-2000@users.noreply.github.com> Date: Tue, 4 Aug 2026 00:30:50 +0200 Subject: [PATCH 3/5] update: migrate to widget.actions --- qrcode/plugin.toml | 3 +++ qrcode/widget.luau | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/qrcode/plugin.toml b/qrcode/plugin.toml index 452bd9c..9955908 100644 --- a/qrcode/plugin.toml +++ b/qrcode/plugin.toml @@ -14,6 +14,9 @@ dependencies = [ "qrencode" ] id = "widget" entry = "widget.luau" + [widget.actions] + left = "panel-toggle yocraft/qrcode:panel" + [[widget.setting]] key = "glyph" type = "glyph" diff --git a/qrcode/widget.luau b/qrcode/widget.luau index b7c9683..387fa32 100644 --- a/qrcode/widget.luau +++ b/qrcode/widget.luau @@ -7,7 +7,3 @@ else end barWidget.setTooltip(noctalia.tr("widget.tooltip")) - -function onClick() - noctalia.togglePanel("yocraft/qrcode:panel") -end From 91a3778a6e5deb6f51413ee4dc2039d4d5120586 Mon Sep 17 00:00:00 2001 From: Yocraft-2000 <304616174+Yocraft-2000@users.noreply.github.com> Date: Tue, 4 Aug 2026 22:33:47 +0200 Subject: [PATCH 4/5] feat: add keep_on_close option --- qrcode/README.md | 2 ++ qrcode/panel.luau | 25 +++++++++++++++++++++++-- qrcode/plugin.toml | 7 +++++++ qrcode/translations/en.json | 4 ++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/qrcode/README.md b/qrcode/README.md index d066eb0..3e4d7c3 100644 --- a/qrcode/README.md +++ b/qrcode/README.md @@ -30,6 +30,7 @@ Enter your text or URL and click on Generate or press enter to generate the QR c | `generate_button` | `bool` | `true` | Show Generate button, disable will submit on enter. | | `close_on_copy` | `bool` | `false` | Close the panel when copying the QR code. | | `notify` | `select` | `minimal` | Controls the notifications, minimal only notifies when Close on Copy is used. | +| `keep_on_close` | `bool` | `false` | Keep the input, QR Code, status etc when closing the panel. | | `size` | `int` | `8` | Specify module size in dots (pixels). | | `correction_level` | `select` | `M` | Specify error correction level. | | `glyph` | `glyph` | `qrcode` | Bar widget icon glyph name. | @@ -38,3 +39,4 @@ Enter your text or URL and click on Generate or press enter to generate the QR c ## Notes The plugin runs entirely locally and does not require network access. +The plugin does not store anyting in files when the panel is closed, except when `keep_on_close` option is enabled. diff --git a/qrcode/panel.luau b/qrcode/panel.luau index bbab2b4..7fe9c78 100644 --- a/qrcode/panel.luau +++ b/qrcode/panel.luau @@ -7,8 +7,23 @@ local status = "idle" local imageSize = 400 local generateButton = noctalia.getConfig("generate_button") +local keepOnClose = noctalia.getConfig("keep_on_close") local notifyConf = noctalia.getConfig("notify") +-- when toggling off keep_on_close, the image will not be deleted, so this runs every config change +if not keepOnClose then + local dir = noctalia.pluginDir() + local files = noctalia.listDir(dir) + + if files then + for _, name in ipairs(files) do + if name:match("^qr-") then + noctalia.removeFile(dir .. "/" .. name) + end + end + end +end + local function notify(text, error) local cmd = error and noctalia.notifyError or noctalia.notify cmd("QR Code encoder", text) @@ -36,6 +51,7 @@ local function render() placeholder = noctalia.tr("panel.placeholder"), onChange = "onTextChange", onSubmit = "onTextSubmit", + value = keepOnClose and currentText or "" }) } @@ -171,7 +187,9 @@ local function generate(text) end function onOpen(_context) - status = "idle" + if not keepOnClose then + status = "idle" + end render() end @@ -221,7 +239,10 @@ function onCloseClicked() end function onClose() - if imagePath ~= nil then + if not keepOnClose and imagePath ~= nil then noctalia.removeFile(imagePath) + imagePath = nil + render() + -- calling render() here so it doesn't try to render the image when opening the panel end end diff --git a/qrcode/plugin.toml b/qrcode/plugin.toml index 9955908..20df948 100644 --- a/qrcode/plugin.toml +++ b/qrcode/plugin.toml @@ -73,6 +73,13 @@ options = [ { value = "none", label_key = "settings.notify.none" }, ] +[[setting]] +key = "keep_on_close" +type = "bool" +label_key = "settings.keep_on_close.label" +description_key = "settings.keep_on_close.description" +default = false + [[setting]] key = "size" type = "int" diff --git a/qrcode/translations/en.json b/qrcode/translations/en.json index 225fc3d..42707bf 100644 --- a/qrcode/translations/en.json +++ b/qrcode/translations/en.json @@ -19,6 +19,10 @@ "minimal": "Minimal", "none": "None" }, + "keep_on_close": { + "label": "Keep on Close", + "description": "Keep the input, QR Code, status etc when closing the panel." + }, "size": { "label": "QR Code Size", "description": "Specify module size in dots (pixels)." From f5293f98d7a282d8787d2f0b2284b5e3cd8c2892 Mon Sep 17 00:00:00 2001 From: Yocraft-2000 <304616174+Yocraft-2000@users.noreply.github.com> Date: Wed, 5 Aug 2026 13:58:23 +0200 Subject: [PATCH 5/5] fix: clear currentText on closing --- qrcode/panel.luau | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qrcode/panel.luau b/qrcode/panel.luau index 7fe9c78..ffb1262 100644 --- a/qrcode/panel.luau +++ b/qrcode/panel.luau @@ -51,7 +51,7 @@ local function render() placeholder = noctalia.tr("panel.placeholder"), onChange = "onTextChange", onSubmit = "onTextSubmit", - value = keepOnClose and currentText or "" + value = currentText }) } @@ -242,6 +242,8 @@ function onClose() if not keepOnClose and imagePath ~= nil then noctalia.removeFile(imagePath) imagePath = nil + errorMessage = nil + currentText = "" render() -- calling render() here so it doesn't try to render the image when opening the panel end