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
10 changes: 8 additions & 2 deletions mpvpaper/mpvpaper_service.luau
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,19 @@ end

-- ── Commands ──────────────────────────────────────────────────────────────

local function setVideo(connector, path)
local function setVideo(connector, path, thumb)
if not available or type(connector) ~= "string" or connector == "" or type(path) ~= "string" or path == "" then
return
end
assignments[connector] = path
persist()
noctalia.setWallpaperEnabled(connector, false)
-- If the user wants to use the video as a static wallpaper, set it.
if cfg("set_static_wallpaper") and type(thumb) == "string" and thumb ~= "" then
if noctalia.fileExists(thumb) then
noctalia.setWallpaper(connector, thumb)
end
end
fifo("set " .. connector .. " " .. path)
publish()
end
Expand Down Expand Up @@ -181,7 +187,7 @@ noctalia.state.watch("command", function(cmd)
return
end
if cmd.action == "set" then
setVideo(cmd.connector, cmd.path)
setVideo(cmd.connector, cmd.path, cmd.thumb)
elseif cmd.action == "clear" then
clearVideo(cmd.connector)
end
Expand Down
9 changes: 5 additions & 4 deletions mpvpaper/panel.luau
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,19 @@ local function selectedConnector()
return selectedConnectorName
end

local function sendCommand(action, connector, path)
local function sendCommand(action, connector, path, thumb)
cmdNonce += 1
noctalia.state.set("command", { action = action, connector = connector, path = path, nonce = cmdNonce })
noctalia.state.set("command", { action = action, connector = connector, path = path, thumb = thumb, nonce = cmdNonce })
end

local function applyVideo(path)
local thumb = thumbPaths[path]
if selectedConnectorName == "" then
for _, output in ipairs(outputsList) do
sendCommand("set", output.name, path)
sendCommand("set", output.name, path, thumb)
end
else
sendCommand("set", selectedConnectorName, path)
sendCommand("set", selectedConnectorName, path, thumb)
end
render()
end
Expand Down
7 changes: 7 additions & 0 deletions mpvpaper/plugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ label_key = "settings.mpv_options.label"
description_key = "settings.mpv_options.description"
default = ""

[[setting]]
key = "set_static_wallpaper"
type = "bool"
label_key = "settings.set_static_wallpaper.label"
description_key = "settings.set_static_wallpaper.description"
default = true

# Headless background service: owns the mpvpaper supervisor and per-output assignments.
[[service]]
id = "service"
Expand Down
4 changes: 3 additions & 1 deletion mpvpaper/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
"settings.auto_pause.description": "Pause playback while a fullscreen window covers the wallpaper (mpvpaper --auto-pause).",
"settings.mpv_options.label": "Extra mpv options",
"settings.mpv_options.description": "Additional space-separated mpv options, e.g. panscan=1.0 video-zoom=0.1",
"settings.set_static_wallpaper.label": "Set static wallpaper",
"settings.set_static_wallpaper.description": "Set the video thumbnail as static wallpaper when selected.",
"settings.glyph.label": "Glyph"
}
}