mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 00:12:50 -05:00
Remove redundant focused name if appTitle & appName match
This commit is contained in:
@@ -69,7 +69,22 @@ Rectangle {
|
|||||||
StyledText {
|
StyledText {
|
||||||
id: titleText
|
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.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
|
|||||||
Reference in New Issue
Block a user