From 2b2eb8cadd90cb3029b2fc2ae5fcb5b0cc716676 Mon Sep 17 00:00:00 2001 From: Ahmed5Emad Date: Sun, 23 Aug 2026 09:52:09 +0300 Subject: [PATCH 1/2] feat(screen-toolkit): add hide-when-unused toggle for widget (#444) Hide bar widget when no recording is active when enabled; widget appears only while recording. Closes #444 --- screen-toolkit/plugin.toml | 7 +++++++ screen-toolkit/translations/en.json | 4 ++++ screen-toolkit/widget.luau | 18 ++++++++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/screen-toolkit/plugin.toml b/screen-toolkit/plugin.toml index 6c7b7225..f35267bd 100644 --- a/screen-toolkit/plugin.toml +++ b/screen-toolkit/plugin.toml @@ -157,6 +157,13 @@ label_key = "settings.record_audio_in.label" description_key = "settings.record_audio_in.description" default = false +[[setting]] +key = "hide-when-unused" +type = "bool" +label_key = "settings.hide_when_unused.label" +description_key = "settings.hide_when_unused.description" +default = false + [[setting]] key = "hide-cursor" type = "bool" diff --git a/screen-toolkit/translations/en.json b/screen-toolkit/translations/en.json index 76ec92d4..bb6f4c8a 100644 --- a/screen-toolkit/translations/en.json +++ b/screen-toolkit/translations/en.json @@ -93,6 +93,10 @@ "description": "Maximum duration in seconds for GIF recordings.", "label": "Max GIF Duration" }, + "hide_when_unused": { + "description": "Hide the bar widget when no recording is active. It will appear only while recording.", + "label": "Hide When Unused" + }, "hide_cursor": { "description": "Exclude the cursor from recordings. Screenshots never include the cursor.", "label": "Hide Cursor in Recordings" diff --git a/screen-toolkit/widget.luau b/screen-toolkit/widget.luau index eec96749..055e1345 100644 --- a/screen-toolkit/widget.luau +++ b/screen-toolkit/widget.luau @@ -6,10 +6,13 @@ -- Recording logic lives in the [[service]] — this widget -- only reflects the published state and drives the service through the -- "command" state channel. +-- When "hide-when-unused" is enabled, the widget is hidden until a +-- recording starts (issue #444). -local recording = false +local recording = noctalia.state.get("recording") == true +local hideWhenUnused = noctalia.getConfig("hide-when-unused") == true local phase = 0 -local startedAt = nil +local startedAt = noctalia.state.get("recordStartedAt") local function elapsed() if not startedAt then return "00:00" end @@ -18,6 +21,12 @@ local function elapsed() end local function render() + if hideWhenUnused and not recording then + barWidget.setVisible(false) + return + end + barWidget.setVisible(true) + local container = barWidget.isVertical() and ui.column or ui.row local children = {} if recording then @@ -52,6 +61,11 @@ noctalia.state.watch("recordStartedAt", function(value) render() end) +function onConfigChanged() + hideWhenUnused = noctalia.getConfig("hide-when-unused") == true + render() +end + function onClick() -- The bar icon never stops a recording; it just opens the panel so the -- stop button (in the panel header, next to the close X) is reachable. From 8ae47c65c3ab2b4caf9701fef45e608e18bddc37 Mon Sep 17 00:00:00 2001 From: Ahmed5Emad Date: Sun, 23 Aug 2026 09:53:06 +0300 Subject: [PATCH 2/2] chore(screen-toolkit): bump version to 1.3.1 --- screen-toolkit/plugin.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/screen-toolkit/plugin.toml b/screen-toolkit/plugin.toml index f35267bd..084256ee 100644 --- a/screen-toolkit/plugin.toml +++ b/screen-toolkit/plugin.toml @@ -8,7 +8,7 @@ id = "alexander/screen-toolkit" name = "Screen Toolkit" -version = "1.3.0" +version = "1.3.1" plugin_api = 13 author = "alexander" license = "MIT"