Skip to content

Commit cb9e86d

Browse files
committed
Update menu bar search interface
* Don't show disabled sections in search list * Update styling * Trim transparent pixels from menu bar item images
1 parent bd4ff51 commit cb9e86d

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Diff for: Ice/MenuBar/Search/MenuBarSearchPanel.swift

+14-9
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ private struct MenuBarSearchContentView: View {
255255

256256
private func updateDisplayedItems() {
257257
let searchItems: [(listItem: ListItem, title: String)] = MenuBarSection.Name.allCases.reduce(into: []) { items, section in
258+
if itemManager.appState?.menuBarManager.section(withName: section)?.isEnabled == false {
259+
return
260+
}
261+
258262
let headerItem = ListItem.header(id: .header(section)) {
259263
Text(section.displayString)
260264
.fontWeight(.semibold)
@@ -323,8 +327,9 @@ private struct BottomBarButton<Content: View>: View {
323327
content
324328
.padding(3)
325329
.background {
326-
VisualEffectView(material: .selection, blendingMode: .withinWindow)
327-
.clipShape(RoundedRectangle(cornerRadius: 5, style: .circular))
330+
RoundedRectangle(cornerRadius: 5, style: .circular)
331+
.fill(.regularMaterial)
332+
.brightness(0.25)
328333
.opacity(isPressed ? 0.5 : isHovering ? 0.25 : 0)
329334
}
330335
.contentShape(Rectangle())
@@ -380,8 +385,9 @@ private struct ShowItemButton: View {
380385
.padding(.horizontal, 7)
381386
.padding(.vertical, 5)
382387
.background {
383-
VisualEffectView(material: .selection, blendingMode: .withinWindow)
384-
.clipShape(RoundedRectangle(cornerRadius: 3, style: .circular))
388+
RoundedRectangle(cornerRadius: 3, style: .circular)
389+
.fill(.regularMaterial)
390+
.brightness(0.25)
385391
.opacity(0.5)
386392
}
387393
}
@@ -403,7 +409,7 @@ private struct MenuBarSearchItemView: View {
403409

404410
private var image: NSImage? {
405411
guard
406-
let image = imageCache.images[item.info],
412+
let image = imageCache.images[item.info]?.trimmingTransparentPixels(around: [.minXEdge, .maxXEdge]),
407413
let screen = imageCache.screen
408414
else {
409415
return nil
@@ -442,10 +448,9 @@ private struct MenuBarSearchItemView: View {
442448
private var imageViewWithBackground: some View {
443449
if let image {
444450
ZStack {
445-
VisualEffectView(material: .selection, blendingMode: .behindWindow)
446-
.clipShape(
447-
RoundedRectangle(cornerRadius: 5, style: .circular)
448-
)
451+
RoundedRectangle(cornerRadius: 5, style: .circular)
452+
.fill(.regularMaterial)
453+
.brightness(0.25)
449454
.opacity(0.75)
450455
.frame(width: item.frame.width)
451456
.overlay {

0 commit comments

Comments
 (0)