diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-29 10:12:17 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-29 10:12:17 +0100 |
| commit | 0a7db3b48cce5f064c20f280e345a8bf1feb5ecb (patch) | |
| tree | eaf9c4be1a832893acf327019ef71a352d9d6647 /desktop/companion/Lines.js | |
| parent | 28beb8a9600b6e74cab454401cc94c664d90bfe5 (diff) | |
| download | quickshell-0a7db3b48cce5f064c20f280e345a8bf1feb5ecb.tar.gz quickshell-0a7db3b48cce5f064c20f280e345a8bf1feb5ecb.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'desktop/companion/Lines.js')
| -rw-r--r-- | desktop/companion/Lines.js | 146 |
1 files changed, 0 insertions, 146 deletions
diff --git a/desktop/companion/Lines.js b/desktop/companion/Lines.js deleted file mode 100644 index 77e7a83..0000000 --- a/desktop/companion/Lines.js +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (C) 2026 Danilo M. <danix@danix.xyz> -// -// 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 - -// What she says, in English, grouped by the reaction that says it. -// Companion.qml picks one at random per reaction and keeps to one line in -// 30 s, except for clicks and the self-destruct (Mood.canSpeak). - -var lines = { - shown: ["Glory to mankind.", "2B, reporting.", "...Back on duty."], - bye: ["2B, signing off.", "Rest while you can.", "Duty complete."], - bored: ["...Operator, I'm bored.", "Nothing to report.", "Awaiting orders."], - wake: ["I'm awake.", "Systems online."], - mock: ["Typo again?", "Delete, delete, delete.", "Were you aiming for that key?"], - shoved: ["Hey.", "Rude.", "I was standing here."], - ready: ["Answer's ready.", "Your reply came in."], - headphones: ["...Good song.", "Music. Finally.", "I'll allow this one.", "Louder."], - groove: ["This one's good.", "...Don't tell 9S.", "Again. Play it again."], - click: ["...Yes?", "Can I help you?"], - blush: ["S-stop that.", "...Operator."], - wallpaper: ["...!", "W-what is this?", "I wasn't staring."], - dodge: ["...Fine.", "I'll move."], - destruct: ["Self-destruct sequence initiated."], - aftermath: ["...That was unpleasant."], -}; - -// The lines for a program she recognizes, by lowercased window class: one is -// said at random when focus moves to it. The settings window's Companion -// phrases page edits them into Prefs.companionApps, which then replaces this -// whole set; a class with no entry says nothing. -var apps = { - firefox: ["Researching again?", "Don't open too many tabs.", "The Bunker's network is faster."], - kitty: ["A terminal. Serious work.", "Careful with that rm.", "I'll watch your commands."], - discord: ["Talking to the Resistance?", "Don't tell them where we are."], - signal: ["Encrypted. Good."], - steam: ["Training simulation?", "Don't play all night."], - gimp: ["Making art?"], - "com.obsproject.studio": ["Are we recording?", "I'll stay out of frame."], - "md.obsidian.obsidian": ["Writing a report?", "Taking notes. Good habit."], - sublime_text: ["Writing code?", "Mind the typos."], - qtmaildir: ["Any orders from Command?", "Mail. Anything urgent?"], - "virt-manager": ["More machines?", "Androids running androids."], - audacious: ["Music. I like this."], - llamachat: ["Talking to Pod?"], - qtpass: ["I'm not looking."], -}; - -// The lines for an artist she knows, keyed by a lowercased name matched as -// a substring of the reported artist, so "daft punk" also catches -// collaborations. The Companion artists page edits them into -// Prefs.companionArtists, which then replaces this whole set. -var artists = { - "linkin park": ["In the end, it doesn't even matter.", "Crawling in my skin... I know this one."], - "evanescence": ["Wake me up inside. ...Operator, don't laugh."], - "gigi d'agostino": ["L'amour toujours. I'll fly with you.", "...My feet are moving on their own."], - "eminem": ["Lose yourself. Understood.", "He talks faster than Pod."], -}; - -// The game's opening, one sentence per bubble. -var monologue = [ - "Everything that lives is designed to end.", - "We are perpetually trapped in a never-ending spiral of life and death.", - "Is this a curse?", - "Or some kind of punishment?", - "I often think about the god who blessed us with this cryptic puzzle...and wonder if we'll ever get the chance to kill him.", -]; - -// A set in effect: saved when it is a plain object, the defaults (apps -// unless given) otherwise. A malformed saved value must not leave her mute. -function appMap(saved, defaults) { - return saved && typeof saved === "object" && !Array.isArray(saved) ? saved : (defaults || apps); -} - -// A set as an ordered list of {cls, lines}, for the settings pages; cls is -// the key, a window class or an artist. -function appList(saved, defaults) { - const m = appMap(saved, defaults); - const keys = Object.keys(m); - const out = []; - for (let i = 0; i < keys.length; i++) - out.push({ cls: keys[i], lines: (m[keys[i]] || []).slice() }); - return out; -} - -function nonEmpty(all) { - const l = []; - for (let i = 0; i < (all || []).length; i++) - if (typeof all[i] === "string" && all[i].trim() !== "") l.push(all[i]); - return l; -} - -function at(l, roll) { return l.length ? l[Math.min(l.length - 1, Math.floor(roll * l.length))] : ""; } - -// A line for an app class, empty strings skipped; "" when the class has none. -function pickApp(cls, saved, roll) { return at(nonEmpty(appMap(saved)[cls]), roll); } - -// A line for the playing artist: the first key that is a case-insensitive -// substring of it and has a non-empty line. ponytail: substring, so a -// short key like "air" also matches "Airbourne"; whole words if that bites. -function pickArtist(artist, saved, roll) { - const a = String(artist || "").toLowerCase(); - if (a === "") return ""; - const m = appMap(saved, artists); - const keys = Object.keys(m); - for (let i = 0; i < keys.length; i++) { - const l = nonEmpty(m[keys[i]]); - if (keys[i] !== "" && l.length && a.indexOf(keys[i].toLowerCase()) !== -1) return at(l, roll); - } - return ""; -} - -// A line for a reaction kind, or, with an "app:" or "artist:" prefix, for -// that class or artist. -function pick(kind, roll, saved, savedArtists) { - if (kind.slice(0, 4) === "app:") return pickApp(kind.slice(4), saved, roll); - if (kind.slice(0, 7) === "artist:") return pickArtist(kind.slice(7), savedArtists, roll); - return at(lines[kind] || [], roll); -} - -// The page's list back to a map for Prefs: empty classes and phrases dropped, -// the class lowercased (Hyprland reports it that way), a repeated class -// keeping its last entry. -function toMap(list) { - const m = {}; - for (let i = 0; i < list.length; i++) { - const cls = String(list[i].cls || "").trim().toLowerCase(); - if (cls === "") continue; - const src = list[i].lines || []; - const ls = []; - for (let j = 0; j < src.length; j++) { - const s = String(src[j] || "").trim(); - if (s !== "") ls.push(s); - } - if (ls.length) m[cls] = ls; - } - return m; -} |
