@@ -61,6 +61,19 @@ struct ContentView: View {
6161 tabPrefix = " tab "
6262 }
6363 announcement = " \( tabPrefix) \( title) , \( item. ownerName) "
64+ } else if item. isSlackItem {
65+ let prefix : String
66+ switch item. kind {
67+ case . slackWorkspace:
68+ prefix = " workspace "
69+ case . slackChannel:
70+ prefix = " channel "
71+ case . slackDM:
72+ prefix = " dm "
73+ case . window, . terminalTab, . chromeTab:
74+ prefix = " item "
75+ }
76+ announcement = " \( prefix) \( title) , Slack "
6477 } else {
6578 let app = item. title. isEmpty ? " " : " , \( item. ownerName) "
6679 announcement = " \( title) \( app) "
@@ -78,14 +91,14 @@ struct ContentView: View {
7891 var body : some View {
7992 VStack ( spacing: 0 ) {
8093 // Search field
81- TextField ( " Search windows and tabs ... " , text: $searchQuery)
94+ TextField ( " Search windows, tabs, and Slack ... " , text: $searchQuery)
8295 . textFieldStyle ( . plain)
8396 . font ( . system( size: 18 ) )
8497 . padding ( 12 )
8598 . background ( Color ( NSColor . controlBackgroundColor) )
8699 . focused ( $isSearchFocused)
87- . accessibilityLabel ( " Search for windows and tabs " )
88- . accessibilityHint ( " Type to filter windows, tabs, and application names " )
100+ . accessibilityLabel ( " Search for windows, tabs, and Slack items " )
101+ . accessibilityHint ( " Type to filter windows, tabs, Slack workspaces, channels, direct messages, and application names " )
89102 . accessibilityValue ( searchQuery. isEmpty ? " Empty " : searchQuery)
90103 . onSubmit {
91104 // If in history mode, select the highlighted history item
@@ -309,7 +322,19 @@ struct WindowRow: View {
309322 var accessibilityDescription : String {
310323 let title = window. title. isEmpty ? window. ownerName : window. title
311324 let app = window. title. isEmpty ? " " : " , \( window. ownerName) "
312- let role = window. isTab ? " Tab " : " Window "
325+ let role : String
326+ switch window. kind {
327+ case . terminalTab, . chromeTab:
328+ role = " Tab "
329+ case . slackWorkspace:
330+ role = " Workspace "
331+ case . slackChannel:
332+ role = " Channel "
333+ case . slackDM:
334+ role = " Direct message "
335+ case . window:
336+ role = " Window "
337+ }
313338 let position = " \( role) \( index) of \( total) "
314339 let state = isSelected ? " , selected " : " "
315340 if window. isTab {
@@ -322,6 +347,21 @@ struct WindowRow: View {
322347 let subtitle = window. subtitle. map { " , \( $0) " } ?? " "
323348 return " \( tabPrefix) \( title) \( subtitle) \( app) . \( position) \( state) "
324349 }
350+ if window. isSlackItem {
351+ let prefix : String
352+ switch window. kind {
353+ case . slackWorkspace:
354+ prefix = " workspace "
355+ case . slackChannel:
356+ prefix = " channel "
357+ case . slackDM:
358+ prefix = " dm "
359+ case . window, . terminalTab, . chromeTab:
360+ prefix = " item "
361+ }
362+ let subtitle = window. subtitle. map { " , \( $0) " } ?? " "
363+ return " \( prefix) \( title) \( subtitle) , Slack. \( position) \( state) "
364+ }
325365 return " \( title) \( app) . \( position) \( state) "
326366 }
327367
@@ -337,8 +377,8 @@ struct WindowRow: View {
337377
338378 VStack ( alignment: . leading, spacing: 2 ) {
339379 HStack ( spacing: 8 ) {
340- if window . isTab {
341- Text ( " TAB " )
380+ if let badgeText = rowBadgeText {
381+ Text ( badgeText )
342382 . font ( . system( size: 10 , weight: . semibold) )
343383 . foregroundColor ( . accentColor)
344384 . padding ( . horizontal, 6 )
@@ -371,7 +411,30 @@ struct WindowRow: View {
371411 . cornerRadius ( 4 )
372412 . accessibilityElement ( children: . combine)
373413 . accessibilityLabel ( accessibilityDescription)
374- . accessibilityHint ( window . isTab ? " Press Enter to switch to this tab " : " Press Enter to switch to this window " )
414+ . accessibilityHint ( accessibilityHintText )
375415 . accessibilityAddTraits ( isSelected ? [ . isSelected, . isButton] : [ . isButton] )
376416 }
417+
418+ private var rowBadgeText : String ? {
419+ if window. isTab {
420+ return " TAB "
421+ }
422+
423+ return window. slackBadgeText
424+ }
425+
426+ private var accessibilityHintText : String {
427+ switch window. kind {
428+ case . terminalTab, . chromeTab:
429+ return " Press Enter to switch to this tab "
430+ case . slackWorkspace:
431+ return " Press Enter to switch to this Slack workspace "
432+ case . slackChannel:
433+ return " Press Enter to open this Slack channel "
434+ case . slackDM:
435+ return " Press Enter to open this Slack direct message "
436+ case . window:
437+ return " Press Enter to switch to this window "
438+ }
439+ }
377440}
0 commit comments