33/// The tray icon is a 32×32 RGBA image:
44/// - Solid filled background circle in the theme's background color.
55/// - Progress arc from 12 o'clock sweeping clockwise, colored by round type.
6- /// - While paused: two vertical bars drawn over the background (no arc) .
6+ /// - While paused: two vertical bars drawn over the progress arc.
77///
88/// Colors come from the active theme, updated when theme changes.
99/// The tray is created/destroyed when `min_to_tray` setting changes.
@@ -368,7 +368,7 @@ pub fn destroy_tray(state: &Arc<TrayState>) {
368368/// Re-render and push a new RGBA icon to the tray.
369369///
370370/// - `round_type`: "work" | "short-break" | "long-break"
371- /// - `paused`: show pause bars instead of an arc
371+ /// - `paused`: show pause bars over the progress arc
372372/// - `progress`: 0.0 (empty) to 1.0 (full, i.e. elapsed/total)
373373pub fn update_icon ( state : & Arc < TrayState > , round_type : & str , paused : bool , progress : f32 ) {
374374 let guard = state. icon . lock ( ) . unwrap ( ) ;
@@ -464,6 +464,19 @@ pub fn render_tray_icon_rgba(
464464 _ => rgba_color ( colors. focus_round ) ,
465465 } ;
466466
467+ // Progress arc from 12 o'clock, clockwise, in the round-type colour.
468+ paint. set_color ( round_color) ;
469+
470+ // In elapsed mode the arc grows as time passes; in countdown mode it shrinks.
471+ let effective = if countdown { 1.0 - progress } else { progress } ;
472+ let sweep = effective. clamp ( 0.0 , 1.0 ) * TAU ;
473+ if sweep > 0.001 {
474+ let start = -FRAC_PI_2 ;
475+ let end = start + sweep;
476+ let path = build_arc_path ( CENTER , CENTER , RADIUS , start, end) ;
477+ pixmap. stroke_path ( & path, & paint, & stroke, Transform :: identity ( ) , None ) ;
478+ }
479+
467480 if paused {
468481 // Two vertical bars centred in the ring, in the round-type colour so
469482 // they read clearly on any panel colour regardless of theme foreground.
@@ -481,19 +494,6 @@ pub fn render_tray_icon_rgba(
481494 ) ;
482495 }
483496 }
484- } else {
485- // Progress arc from 12 o'clock, clockwise, in the round-type colour.
486- paint. set_color ( round_color) ;
487-
488- // In elapsed mode the arc grows as time passes; in countdown mode it shrinks.
489- let effective = if countdown { 1.0 - progress } else { progress } ;
490- let sweep = effective. clamp ( 0.0 , 1.0 ) * TAU ;
491- if sweep > 0.001 {
492- let start = -FRAC_PI_2 ;
493- let end = start + sweep;
494- let path = build_arc_path ( CENTER , CENTER , RADIUS , start, end) ;
495- pixmap. stroke_path ( & path, & paint, & stroke, Transform :: identity ( ) , None ) ;
496- }
497497 }
498498
499499 pixmap. take ( )
@@ -550,6 +550,20 @@ mod tests {
550550 assert_eq ! ( bytes. len( ) , ( SIZE * SIZE * 4 ) as usize ) ;
551551 }
552552
553+ #[ test]
554+ fn render_paused_preserves_progress_arc ( ) {
555+ let empty = render_tray_icon_rgba ( & TrayColors :: default ( ) , true , 0.0 , "work" , false ) ;
556+ let half = render_tray_icon_rgba ( & TrayColors :: default ( ) , true , 0.5 , "work" , false ) ;
557+ assert ! ( empty != half) ;
558+ }
559+
560+ #[ test]
561+ fn render_paused_still_shows_pause_indicator ( ) {
562+ let running = render_tray_icon_rgba ( & TrayColors :: default ( ) , false , 0.5 , "work" , false ) ;
563+ let paused = render_tray_icon_rgba ( & TrayColors :: default ( ) , true , 0.5 , "work" , false ) ;
564+ assert ! ( running != paused) ;
565+ }
566+
553567 #[ test]
554568 fn render_zero_progress_returns_correct_byte_count ( ) {
555569 let bytes = render_tray_icon_rgba ( & TrayColors :: default ( ) , false , 0.0 , "work" , false ) ;
0 commit comments