// Copyright (C) 2026 Danilo M. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. .pragma library // The wallpapers the companion blushes at, as a plain text file: one // absolute path per line, blank lines and lines starting with # skipped. // Pure, so test_mood.js drives it; Admired.qml reads and writes the file. function parse(text) { const out = []; for (const l of text.split("\n")) { const p = l.trim(); if (p !== "" && p[0] !== "#") out.push(p); } return out; } // text with path's line removed if it is listed, else appended. Comments // and every other line stay as they are. function toggle(text, path) { const lines = text === "" ? [] : text.replace(/\n$/, "").split("\n"); const kept = lines.filter(l => l.trim() !== path); if (kept.length === lines.length) kept.push(path); return kept.length ? kept.join("\n") + "\n" : ""; } // wallp.conf's OUTPUT_H and OUTPUT_V, as { connector: "H" | "V" }. An exec // loop, because QML's engine has no String.matchAll. function outputs(conf) { const out = {}; const re = /^\s*OUTPUT_([HV])\s*=\s*(\S+)/gm; let m; while ((m = re.exec(conf)) !== null) out[m[2]] = m[1]; return out; }