From 0a7db3b48cce5f064c20f280e345a8bf1feb5ecb Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 29 Oct 2026 10:12:17 +0100 Subject: companion: remove from the tree, archived as tag archive/companion The chibi 2B companion is retired for now. Its last state is kept in the signed tag archive/companion (the commit before this one), so it can be revisited with `git checkout archive/companion`; hypr-theme carries a tag of the same name for its compositor hooks (typing/delete events and the SUPER+\ bind). Removed with it, since nothing else used them: the Companion, phrases and artists settings pages, the five companion prefs in Prefs.qml and Prefs.ready, the wallpaper heart (Admired.qml's list), the assistant's replied() signal and cardTop, and the keybinds reminder's name for the code:49 bind. The design specs and plans under docs/ stay as history. Co-Authored-By: Claude Opus 5.5 --- desktop/companion/test_lines.js | 79 ----------------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 desktop/companion/test_lines.js (limited to 'desktop/companion/test_lines.js') diff --git a/desktop/companion/test_lines.js b/desktop/companion/test_lines.js deleted file mode 100644 index 72addf2..0000000 --- a/desktop/companion/test_lines.js +++ /dev/null @@ -1,79 +0,0 @@ -// 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. - -// Run: node desktop/companion/test_lines.js -// Lines.js is a QML library, so its .pragma line is stripped before node -// evaluates it. - -const fs = require("fs"); -const assert = require("assert"); - -const src = fs.readFileSync(__dirname + "/Lines.js", "utf8") - .replace(/^\.pragma library$/m, ""); -const L = new Function(src + - "\nreturn { lines, apps, artists, monologue, appMap, appList, pickApp, pickArtist, pick, toMap };")(); - -// The defaults are what she says until a set is saved. -assert.strictEqual(L.pickApp("firefox", null, 0), L.apps.firefox[0]); -assert.strictEqual(L.pickApp("firefox", null, 0.99), L.apps.firefox[L.apps.firefox.length - 1]); -assert.strictEqual(L.pickApp("nope", null, 0), ""); -assert.strictEqual(L.appMap(null), L.apps); -// A hand edit with a typo reads as the defaults, not as silence. -assert.strictEqual(L.appMap("typo"), L.apps); -assert.strictEqual(L.appMap(["not", "a", "map"]), L.apps); - -// A saved set replaces the defaults, class by class. -assert.strictEqual(L.pickApp("firefox", { firefox: ["hi"] }, 0), "hi"); -assert.strictEqual(L.pickApp("kitty", { firefox: ["hi"] }, 0), ""); -assert.strictEqual(L.pick("app:firefox", 0, { firefox: ["custom"] }), "custom"); -assert.strictEqual(L.pick("app:firefox", 0), L.apps.firefox[0]); - -// Empty phrases are skipped when picking; a class with only empty ones says -// nothing. -assert.strictEqual(L.pickApp("firefox", { firefox: ["", " ", "only"] }, 0), "only"); -assert.strictEqual(L.pickApp("firefox", { firefox: ["", " "] }, 0), ""); - -// Reactions still come from lines. -assert.strictEqual(L.pick("shown", 0), L.lines.shown[0]); -assert.strictEqual(L.pick("nope", 0), ""); - -// The saved set as an ordered list, for the settings page. -const list = L.appList(null); -assert.strictEqual(list.length, Object.keys(L.apps).length); -assert.deepStrictEqual(list[0], { cls: "firefox", lines: L.apps.firefox.slice() }); -assert.deepStrictEqual(L.appList({ kitty: ["a"] }), [{ cls: "kitty", lines: ["a"] }]); - -// Back to a map: trim, lowercase the class, drop empty classes and empty -// phrases, and a repeated class keeps its last entry. -assert.deepStrictEqual(L.toMap([ - { cls: " Firefox ", lines: [" one ", "", " ", "two"] }, - { cls: "", lines: ["dropped"] }, - { cls: "kitty", lines: ["", " "] }, - { cls: "firefox", lines: ["last"] }, -]), { firefox: ["last"] }); - -// Artists: a case-insensitive substring of what MPRIS reports, first -// matching key wins, empty phrases skipped. -assert.strictEqual(L.pickArtist("Linkin Park", null, 0), L.artists["linkin park"][0]); -assert.strictEqual(L.pickArtist("LINKIN PARK, Jay-Z", null, 0), L.artists["linkin park"][0]); -assert.strictEqual(L.pickArtist("Nobody", null, 0), ""); -assert.strictEqual(L.pickArtist("", null, 0), ""); -assert.strictEqual(L.pickArtist("Air, Beck", { air: ["a"], beck: ["b"] }, 0), "a"); -assert.strictEqual(L.pickArtist("Airbourne", { air: ["", "a"] }, 0), "a"); -assert.strictEqual(L.pick("artist:Eminem", 0, null, null), L.artists.eminem[0]); -assert.strictEqual(L.pick("artist:Eminem", 0, null, { eminem: ["mine"] }), "mine"); -assert.strictEqual(L.pick("groove", 0), L.lines.groove[0]); - -// The same list helpers serve the artist set. -assert.strictEqual(L.appMap(null, L.artists), L.artists); -assert.strictEqual(L.appList(null, L.artists).length, Object.keys(L.artists).length); -assert.deepStrictEqual(L.toMap(L.appList(null, L.artists)), L.artists); -console.log("ok"); -- cgit v1.2.3