Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions qrcode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Transform any text or URL into a QR code completely offline. Then scan or copy t
| Field | Value |
| --- | --- |
| ID | `yocraft/qrcode` |
| Entries | Bar widget: `widget`; panel: `panel` |
| Entries | Bar widget: `widget`; panel: `panel`; shortcut: `shortcut` |

## Requirements

Install `qrencode` on `PATH`.

## Usage

Open the panel from the bar widget or with this command:
Open the panel from the `QR Code Encoder` bar widget, the control center tile, or with this command:
```sh
noctalia msg panel-toggle yocraft/qrcode:panel
```
Expand Down
7 changes: 6 additions & 1 deletion qrcode/panel.luau
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local imageSize = 400
local generateButton = noctalia.getConfig("generate_button")
local keepOnClose = noctalia.getConfig("keep_on_close")
local notifyConf = noctalia.getConfig("notify")
local corner_radius_scale = 1.0

-- when toggling off keep_on_close, the image will not be deleted, so this runs every config change
if not keepOnClose then
Expand Down Expand Up @@ -88,7 +89,7 @@ local function render()
path = imagePath,
width = imageSize,
height = imageSize,
radius = 24,
radius = 24 * corner_radius_scale,
onClick = "onImageClick",
})
})
Expand Down Expand Up @@ -187,9 +188,13 @@ local function generate(text)
end

function onOpen(_context)
-- here because it needs to be reloaded when the setting is changed
corner_radius_scale = noctalia.getSetting("shell.corner_radius_scale") or 1.0

if not keepOnClose then
status = "idle"
end

render()
end

Expand Down
6 changes: 5 additions & 1 deletion qrcode/plugin.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id = "yocraft/qrcode"
name = "QR Code Encoder"
version = "1.0.1"
version = "1.1.0"
plugin_api = 15
author = "yocraft"
license = "MIT"
Expand Down Expand Up @@ -32,6 +32,10 @@ entry = "widget.luau"
default = ""
extensions = [".png", ".jpg", ".jpeg", ".webp", ".svg"]

[[shortcut]]
id = "shortcut"
entry = "shortcut.luau"

[[panel]]
id = "panel"
entry = "panel.luau"
Expand Down
10 changes: 10 additions & 0 deletions qrcode/shortcut.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
local function render()
shortcut.setLabel("QR Code")
shortcut.setIcon("qrcode")
end

render()

function onClick()
noctalia.togglePanel("yocraft/qrcode:panel")
end