Files
community-plugins/w-engine/w-engine.luau
T
Jacob SabellaandGitHub 68c64f31b1 feat(w-engine): sync shell palette, cycle wallpapers, expose engine options (#161)
Noctalia derives its color scheme from whatever image is set as the
wallpaper. A live Wallpaper Engine scene is not an image the shell can
read, so the palette stayed pinned to whatever wallpaper came before.
Applying a wallpaper now also hands Noctalia a still of it -- the
Workshop preview, or a decoded frame for video wallpapers when ffmpeg is
present -- so the configured generator, scheme, mode and templates all
run exactly as they do for an ordinary wallpaper. The previous wallpaper
is saved per output and restored on stop. Toggle: sync_colors.

Add multi-select with timed cycling. Selected wallpapers carry a badge
showing their place in the rotation, and play in selection order or
shuffled; random plays a full pass before reshuffling so nothing repeats
back to back. Selection, interval and order are per output.

Add per-wallpaper settings behind a gear on each tile: the
linux-wallpaperengine switches (scaling, clamp, layer, FPS, volume,
mute, particles, mouse, parallax, fullscreen pause), plus the
wallpaper's own properties parsed from project.json and rendered by
declared type, honoring each property's visibility condition.

Move process ownership, the palette sync and the cycle timer into the
service. The panel is now pure UI talking over noctalia.state, so a
cycle keeps running while the panel is closed and one owner holds the
pid files.

Fix three process-handling bugs along the way:

- The running-process check anchored on "^linux-wallpaperengine", but
  packagers ship a wrapper that execs ./linux-wallpaperengine from its
  own directory, so no process ever matched and every apply leaked
  another GPU client onto the same output.
- Current builds ignore both SIGTERM and SIGINT, so the kill never
  landed either. Stopping now escalates to SIGKILL after a grace period.
- The reload sweep used pkill -f, which matches the shell running the
  command itself and killed it part way through, leaving orphans.

Cache a static still per wallpaper for the grid. Workshop previews are
frequently animated GIFs, and the grid decoded and animated all of them
continuously for as long as the panel was open.

plugin_api moves 3 -> 9: tile and control callbacks are Luau closures
rather than named globals, which the host resolves from API 9 onwards.
This is what the plugin already required; the manifest understated it.
2026-07-30 21:09:15 -04:00

39 lines
926 B
Luau

--!nonstrict
-- W-Engine bar widget — opens the panel, and reflects what the service is doing.
local STATUS_KEY = "w_engine_status"
local function refresh(status)
local outputs = type(status) == "table" and status.outputs or nil
local cycling = false
local playing = 0
if type(outputs) == "table" then
for _, state in pairs(outputs) do
if type(state) == "table" then
if state.cycle_enabled then
cycling = true
end
if state.current then
playing += 1
end
end
end
end
barWidget.setGlyph("movie")
if playing == 0 then
barWidget.setTooltip(noctalia.tr("widget.idle"))
elseif cycling then
barWidget.setTooltip(noctalia.tr("widget.cycling"))
else
barWidget.setTooltip(noctalia.tr("widget.playing"))
end
end
function onClick()
noctalia.togglePanel("tadomika_ari/w-engine:w-engine-panel")
end
noctalia.state.watch(STATUS_KEY, refresh)
refresh(noctalia.state.get(STATUS_KEY))