@@ -6,7 +6,6 @@ package main
66
77import (
88 "context"
9- _ "embed"
109 "fmt"
1110 "log"
1211 "os"
@@ -20,9 +19,6 @@ import (
2019 "github.com/ready-to-review/turnclient/pkg/turn"
2120)
2221
23- //go:embed menubar-icon.png
24- var embeddedIcon []byte
25-
2622// Version information - set during build with -ldflags.
2723var (
2824 version = "dev"
@@ -69,6 +65,7 @@ type App struct {
6965 consecutiveFailures int
7066 mu sync.RWMutex
7167 hideStaleIncoming bool
68+ initialLoadComplete bool
7269}
7370
7471func main () {
@@ -120,7 +117,6 @@ func main() {
120117
121118func (app * App ) onReady (ctx context.Context ) {
122119 log .Println ("System tray ready" )
123- systray .SetIcon (embeddedIcon )
124120 systray .SetTitle ("Loading PRs..." )
125121 systray .SetTooltip ("GitHub PR Monitor" )
126122
@@ -228,12 +224,14 @@ func (app *App) updatePRs(ctx context.Context) {
228224 if ! app .hideStaleIncoming || ! isStale (incoming [i ].UpdatedAt ) {
229225 incomingBlocked ++
230226 }
231- // Send notification for newly blocked
232- if ! oldBlockedPRs [incoming [i ].URL ] {
227+ // Send notification and play sound if PR wasn't blocked before
228+ // (only after initial load to avoid startup noise)
229+ if app .initialLoadComplete && ! oldBlockedPRs [incoming [i ].URL ] {
233230 if err := beeep .Notify ("PR Blocked on You" ,
234231 fmt .Sprintf ("%s #%d: %s" , incoming [i ].Repository , incoming [i ].Number , incoming [i ].Title ), "" ); err != nil {
235232 log .Printf ("Failed to send notification: %v" , err )
236233 }
234+ app .playSound (ctx , "detective" )
237235 }
238236 }
239237 }
@@ -244,12 +242,14 @@ func (app *App) updatePRs(ctx context.Context) {
244242 if ! app .hideStaleIncoming || ! isStale (outgoing [i ].UpdatedAt ) {
245243 outgoingBlocked ++
246244 }
247- // Send notification for newly blocked
248- if ! oldBlockedPRs [outgoing [i ].URL ] {
245+ // Send notification and play sound if PR wasn't blocked before
246+ // (only after initial load to avoid startup noise)
247+ if app .initialLoadComplete && ! oldBlockedPRs [outgoing [i ].URL ] {
249248 if err := beeep .Notify ("PR Blocked on You" ,
250249 fmt .Sprintf ("%s #%d: %s" , outgoing [i ].Repository , outgoing [i ].Number , outgoing [i ].Title ), "" ); err != nil {
251250 log .Printf ("Failed to send notification: %v" , err )
252251 }
252+ app .playSound (ctx , "rocket" )
253253 }
254254 }
255255 }
@@ -262,17 +262,25 @@ func (app *App) updatePRs(ctx context.Context) {
262262 app .mu .Unlock ()
263263
264264 // Set title based on PR state
265- systray .SetIcon (embeddedIcon )
266265 switch {
267266 case incomingBlocked == 0 && outgoingBlocked == 0 :
268- systray .SetTitle ("" )
267+ systray .SetTitle ("😊" )
268+ case incomingBlocked > 0 && outgoingBlocked > 0 :
269+ systray .SetTitle (fmt .Sprintf ("🕵️ %d / 🚀 %d" , incomingBlocked , outgoingBlocked ))
269270 case incomingBlocked > 0 :
270- systray .SetTitle (fmt .Sprintf ("%d/%d 🔴 " , incomingBlocked , outgoingBlocked ))
271+ systray .SetTitle (fmt .Sprintf ("🕵️ %d " , incomingBlocked ))
271272 default :
272- systray .SetTitle (fmt .Sprintf ("0/%d 🚀 " , outgoingBlocked ))
273+ systray .SetTitle (fmt .Sprintf ("🚀 %d " , outgoingBlocked ))
273274 }
274275
275276 app .updateMenuIfChanged (ctx )
277+
278+ // Mark initial load as complete after first successful update
279+ if ! app .initialLoadComplete {
280+ app .mu .Lock ()
281+ app .initialLoadComplete = true
282+ app .mu .Unlock ()
283+ }
276284}
277285
278286// isStale returns true if the PR hasn't been updated in over 90 days.
0 commit comments