@@ -106,10 +106,22 @@ fn run_app(terminal: &mut Terminal<CrosstermBackend<Stdout>>) -> Result<()> {
106106 height : 1 ,
107107 } ;
108108
109+ let vol = radio. volume ( ) ;
110+ let bar_width = 12usize ;
111+ let filled = ( vol as usize * bar_width) / 100 ;
112+ let empty = bar_width - filled;
113+ let vol_bar = format ! (
114+ " Volume: [{}{}] {}%" ,
115+ "█" . repeat( filled) ,
116+ "-" . repeat( empty) ,
117+ vol
118+ ) ;
119+
109120 let station_line = Paragraph :: new ( Line :: from ( vec ! [
110121 Span :: styled( format!( "{} " , radio_icon) , radio_style) ,
111122 Span :: styled( radio. station( ) . name, theme. hot( ) ) ,
112123 Span :: styled( status_text, theme. frame( ) ) ,
124+ Span :: styled( vol_bar, theme. frame( ) ) ,
113125 ] ) )
114126 . style ( theme. base ( ) ) ;
115127
@@ -144,6 +156,8 @@ fn run_app(terminal: &mut Terminal<CrosstermBackend<Stdout>>) -> Result<()> {
144156 Span :: styled( format!( "{} " , radio_action) , theme. frame( ) ) ,
145157 Span :: styled( "←/→ " , theme. accent( ) ) ,
146158 Span :: styled( "station " , theme. frame( ) ) ,
159+ Span :: styled( "[/] " , theme. accent( ) ) ,
160+ Span :: styled( "volume " , theme. frame( ) ) ,
147161 Span :: styled( "t " , theme. accent( ) ) ,
148162 Span :: styled( "todos " , theme. frame( ) ) ,
149163 Span :: styled( "T " , theme. accent( ) ) ,
@@ -245,6 +259,8 @@ fn run_app(terminal: &mut Terminal<CrosstermBackend<Stdout>>) -> Result<()> {
245259 }
246260 KeyCode :: Char ( 'r' ) => pomo. stop_reset ( ) ,
247261 KeyCode :: Char ( '+' ) => pomo. add_five_minutes ( ) ,
262+ KeyCode :: Char ( '[' ) => radio. set_volume ( radio. volume ( ) . saturating_sub ( 10 ) ) ,
263+ KeyCode :: Char ( ']' ) => radio. set_volume ( ( radio. volume ( ) + 10 ) . min ( 100 ) ) ,
248264 KeyCode :: Esc => todos. toggle_visible ( ) ,
249265 _ => { }
250266 }
@@ -269,6 +285,8 @@ fn run_app(terminal: &mut Terminal<CrosstermBackend<Stdout>>) -> Result<()> {
269285 KeyCode :: Char ( ' ' ) => pomo. start_pause ( ) ,
270286 KeyCode :: Char ( 'r' ) => pomo. stop_reset ( ) ,
271287 KeyCode :: Char ( '+' ) => pomo. add_five_minutes ( ) ,
288+ KeyCode :: Char ( '[' ) => radio. set_volume ( radio. volume ( ) . saturating_sub ( 10 ) ) ,
289+ KeyCode :: Char ( ']' ) => radio. set_volume ( ( radio. volume ( ) + 10 ) . min ( 100 ) ) ,
272290 _ => { }
273291 }
274292 }
0 commit comments