feat: do not repeat title if window title is app name (closes #5672)
This commit is contained in:
1 parent
14acc0ce7d
commit
30eb5f2116
1 file changed
+5
-1
@@ -374,7 +374,8 @@ class TileView: FlippedView {
|
|||||||
}
|
}
|
||||||
if Preferences.showTitles == .appNameAndWindowTitle {
|
if Preferences.showTitles == .appNameAndWindowTitle {
|
||||||
let appName = window_?.application.localizedName ?? ""
|
let appName = window_?.application.localizedName ?? ""
|
||||||
let offset = appName.isEmpty ? 0 : (appName + " - ").count
|
let windowTitle = window_?.title ?? ""
|
||||||
|
let offset = (appName.isEmpty || appName == windowTitle) ? 0 : (appName + " - ").count
|
||||||
for result in window_?.swAppResults ?? [] {
|
for result in window_?.swAppResults ?? [] {
|
||||||
spanRanges.append(NSRange(location: result.span.lowerBound, length: result.span.count))
|
spanRanges.append(NSRange(location: result.span.lowerBound, length: result.span.count))
|
||||||
}
|
}
|
||||||
@@ -572,6 +573,9 @@ class TileView: FlippedView {
|
|||||||
if Preferences.onlyShowApplications() || Preferences.showTitles == .appName {
|
if Preferences.onlyShowApplications() || Preferences.showTitles == .appName {
|
||||||
return appName ?? ""
|
return appName ?? ""
|
||||||
} else if Preferences.showTitles == .appNameAndWindowTitle {
|
} else if Preferences.showTitles == .appNameAndWindowTitle {
|
||||||
|
if appName == windowTitle {
|
||||||
|
return appName ?? ""
|
||||||
|
}
|
||||||
return [appName, windowTitle].compactMap { $0 }.joined(separator: " - ")
|
return [appName, windowTitle].compactMap { $0 }.joined(separator: " - ")
|
||||||
}
|
}
|
||||||
return windowTitle ?? ""
|
return windowTitle ?? ""
|
||||||
|
|||||||
Reference in new issue
Block a user