1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-03 20:32:07 -04:00

fix(shell): cover edge cases of compact focused app widget (#1918)

Fixes two cases:

- some apps (e.g., Zen browser use the "—" character at the end of
  webpage name)
- in compact mode, when app has only appName, and not window name, we
  should display the appName to avoid empty title.
This commit is contained in:
Marcin Jahn
2026-03-10 15:49:28 +01:00
committed by GitHub
parent d436fa4920
commit 58b700ed0d

View File

@@ -211,16 +211,17 @@ BasePill {
text: {
const title = activeWindow && activeWindow.title ? activeWindow.title : "";
const appName = appText.text;
if (compactMode && title === appName) {
return title;
}
if (!title || !appName) {
return title;
}
if (title.endsWith(" - " + appName)) {
return title.substring(0, title.length - (" - " + appName).length);
}
if (title.endsWith(appName)) {
return title.substring(0, title.length - appName.length).replace(/ - $/, "");
return title.substring(0, title.length - appName.length).replace(/ (-|—) $/, "");
}
return title;