mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-14 09:42:10 -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:
@@ -211,16 +211,17 @@ BasePill {
|
|||||||
text: {
|
text: {
|
||||||
const title = activeWindow && activeWindow.title ? activeWindow.title : "";
|
const title = activeWindow && activeWindow.title ? activeWindow.title : "";
|
||||||
const appName = appText.text;
|
const appName = appText.text;
|
||||||
|
|
||||||
|
if (compactMode && title === appName) {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
if (!title || !appName) {
|
if (!title || !appName) {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title.endsWith(" - " + appName)) {
|
|
||||||
return title.substring(0, title.length - (" - " + appName).length);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (title.endsWith(appName)) {
|
if (title.endsWith(appName)) {
|
||||||
return title.substring(0, title.length - appName.length).replace(/ - $/, "");
|
return title.substring(0, title.length - appName.length).replace(/ (-|—) $/, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
return title;
|
return title;
|
||||||
|
|||||||
Reference in New Issue
Block a user