shell: recover the phone-only edits into the repo
~/souveraine-surfaces/quickshell on the phone is not a git repo and was the only copy of five files. Brought back verbatim: - Gestures.qml, SystemGestureRail.qml: TASK-38 osk-swap detent (DUMP §5, §6) - OnScreenKeyboard.qml: showOsk asks the bus instead of pgrep+sleep 1 - DockAppButton.qml, DockStack.qml: suffix-tolerant AppSearch.resolveEntry resolveEntry itself had been added to the phone's live ~/.config/quickshell/ii tree, which deploy.sh rsyncs from ii-base — the next deploy would have deleted it and left the two dock callers referring to nothing. It lands in ii-base here.
This commit is contained in:
parent
21b602a7d2
commit
5965c64781
6 changed files with 184 additions and 17 deletions
|
|
@ -94,6 +94,47 @@ Singleton {
|
|||
return str.toLowerCase().replace(/_/g, "-");
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a window app_id / pinned appId to its DesktopEntry.
|
||||
*
|
||||
* DesktopEntries.heuristicLookup() matches the entry id and
|
||||
* StartupWMClass, which covers most apps but NOT the ones that append an
|
||||
* instance suffix to their Wayland app_id. Firefox is the reference case:
|
||||
* it derives its remoting name from the profile, so the window reports
|
||||
* "firefox-default" while the entry is "firefox" with
|
||||
* StartupWMClass=firefox. heuristicLookup returns null, and a dock tap on
|
||||
* a pinned-but-not-running app then calls execute() on null — a silent
|
||||
* dead tap that reports no error anywhere.
|
||||
*
|
||||
* So: fall back to trimming trailing "-segment" pieces, longest match
|
||||
* first, then to a StartupWMClass prefix scan. Returns null only when
|
||||
* nothing in the entry set plausibly owns the id.
|
||||
*/
|
||||
function resolveEntry(appId) {
|
||||
if (!appId || appId.length == 0) return null;
|
||||
|
||||
const direct = DesktopEntries.heuristicLookup(appId);
|
||||
if (direct) return direct;
|
||||
|
||||
// "firefox-default" -> "firefox"; "signal-desktop-beta" -> "signal-desktop"
|
||||
let candidate = appId;
|
||||
while (candidate.includes("-")) {
|
||||
candidate = candidate.slice(0, candidate.lastIndexOf("-"));
|
||||
const trimmed = DesktopEntries.heuristicLookup(candidate);
|
||||
if (trimmed) return trimmed;
|
||||
}
|
||||
|
||||
// Last resort: an entry whose StartupWMClass prefixes the app_id.
|
||||
const lowered = appId.toLowerCase();
|
||||
for (const entry of root.list) {
|
||||
const wmClass = entry.startupClass;
|
||||
if (!wmClass || wmClass.length == 0) continue;
|
||||
if (lowered.startsWith(wmClass.toLowerCase())) return entry;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function guessIcon(str) {
|
||||
if (!str || str.length == 0) return "image-missing";
|
||||
|
||||
|
|
@ -153,8 +194,9 @@ Singleton {
|
|||
if (iconExists(guess)) return guess;
|
||||
}
|
||||
|
||||
// Quickshell's desktop entry lookup
|
||||
const heuristicEntry = DesktopEntries.heuristicLookup(str);
|
||||
// Desktop entry lookup, suffix-tolerant so "firefox-default" and
|
||||
// friends land on their real entry's icon instead of falling through.
|
||||
const heuristicEntry = root.resolveEntry(str);
|
||||
if (heuristicEntry) return heuristicEntry.icon;
|
||||
|
||||
// Give up
|
||||
|
|
|
|||
Loading…
Reference in a new issue