Skip to content
Closed
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
9 changes: 8 additions & 1 deletion screen-toolkit/plugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions screen-toolkit/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 16 additions & 2 deletions screen-toolkit/widget.luau
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down
Loading