1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

Remove redundant focused name if appTitle & appName match

This commit is contained in:
purian23
2025-08-19 10:14:27 -04:00
parent 8eb17c28b1
commit 6d05974c3d

View File

@@ -69,7 +69,22 @@ Rectangle {
StyledText {
id: titleText
text: NiriService.focusedWindowTitle || ""
text: {
var title = NiriService.focusedWindowTitle || "";
var appName = appText.text;
if (!title || !appName) return title;
// Remove app name from end of title if it exists there
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;
}
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.surfaceText