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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user