@@ -40,6 +40,7 @@ def __init__(self, stream, **kwargs):
4040 self .stream = stream
4141 self ._updating_from_stream = False
4242 self .set_value (stream .volume / 100 )
43+ self .set_size_request (- 1 , 30 ) # Fixed height for sliders
4344
4445 self .connect ("value-changed" , self .on_value_changed )
4546 stream .connect ("changed" , self .on_stream_changed )
@@ -86,7 +87,7 @@ def __init__(self, title, **kwargs):
8687 orientation = "v" ,
8788 spacing = 8 ,
8889 h_expand = True ,
89- v_expand = True ,
90+ v_expand = False , # Prevent vertical stretching
9091 )
9192
9293 self .title_label = Label (
@@ -101,7 +102,7 @@ def __init__(self, title, **kwargs):
101102 orientation = "v" ,
102103 spacing = 8 ,
103104 h_expand = True ,
104- v_expand = True ,
105+ v_expand = False , # Prevent vertical stretching
105106 )
106107
107108 self .add (self .title_label )
@@ -112,12 +113,15 @@ def update_streams(self, streams):
112113 self .content_box .remove (child )
113114
114115 for stream in streams :
115- # Create container with label and slider
116+ label_text = stream .description
117+ if hasattr (stream , "type" ) and "application" in stream .type .lower ():
118+ label_text = getattr (stream , "name" , stream .description )
119+
116120 stream_container = Box (
117121 orientation = "v" ,
118122 spacing = 4 ,
119123 h_expand = True ,
120- v_align = "center" ,
124+ v_expand = False , # Prevent vertical stretching
121125 )
122126
123127 label = Label (
@@ -128,6 +132,7 @@ def update_streams(self, streams):
128132 v_align = "center" ,
129133 ellipsization = "end" ,
130134 max_chars_width = 45 ,
135+ height_request = 20 , # Fixed height for labels
131136 )
132137
133138 slider = MixerSlider (stream )
@@ -146,7 +151,7 @@ def __init__(self, **kwargs):
146151 orientation = "v" ,
147152 spacing = 8 ,
148153 h_expand = True ,
149- v_expand = True ,
154+ v_expand = True , # Allow Mixer to expand to parent height
150155 )
151156
152157 try :
@@ -166,30 +171,48 @@ def __init__(self, **kwargs):
166171 orientation = "h" if not vertical_mode else "v" ,
167172 spacing = 8 ,
168173 h_expand = True ,
169- v_expand = True ,
174+ v_expand = True , # Allow main_container to expand
170175 )
176+ self .main_container .set_homogeneous (True ) # Equal sizing for outputs and inputs
171177
172- self .main_container .set_homogeneous (True )
173-
178+ # ScrolledWindow for Outputs
179+ self .outputs_scrolled = ScrolledWindow (
180+ name = "outputs-scrolled" ,
181+ h_expand = True ,
182+ v_expand = False , # Prevent vertical expansion
183+ vscrollbar_policy = Gtk .PolicyType .AUTOMATIC , # Vertical scrollbar when needed
184+ hscrollbar_policy = Gtk .PolicyType .NEVER , # Disable horizontal scrollbar
185+ )
174186 self .outputs_section = MixerSection ("Outputs" )
175- self .inputs_section = MixerSection ("Inputs" )
176-
177- self .main_container .add (self .outputs_section )
178- self .main_container .add (self .inputs_section )
187+ self .outputs_scrolled .add (self .outputs_section )
188+ self .outputs_scrolled .set_size_request (- 1 , 150 ) # Fixed height of 150px
189+ self .outputs_scrolled .set_max_content_height (150 ) # Enforce max height
179190
180- self .scrolled = ScrolledWindow (
191+ # ScrolledWindow for Inputs
192+ self .inputs_scrolled = ScrolledWindow (
193+ name = "inputs-scrolled" ,
181194 h_expand = True ,
182- v_expand = True ,
183- child = self .main_container ,
195+ v_expand = False , # Prevent vertical expansion
196+ vscrollbar_policy = Gtk .PolicyType .AUTOMATIC , # Vertical scrollbar when needed
197+ hscrollbar_policy = Gtk .PolicyType .NEVER , # Disable horizontal scrollbar
184198 )
199+ self .inputs_section = MixerSection ("Inputs" )
200+ self .inputs_scrolled .add (self .inputs_section )
201+ self .inputs_scrolled .set_size_request (- 1 , 150 ) # Fixed height of 150px
202+ self .inputs_scrolled .set_max_content_height (150 ) # Enforce max height
203+
204+ self .main_container .add (self .outputs_scrolled )
205+ self .main_container .add (self .inputs_scrolled )
185206
186- self .add (self .scrolled )
207+ self .add (self .main_container )
208+ self .set_size_request (- 1 , 300 ) # Optional: Set total height to 300px (150px per section)
187209
188210 self .audio .connect ("changed" , self .on_audio_changed )
189211 self .audio .connect ("stream-added" , self .on_audio_changed )
190212 self .audio .connect ("stream-removed" , self .on_audio_changed )
191213
192214 self .update_mixer ()
215+ self .show_all ()
193216
194217 def on_audio_changed (self , * args ):
195218 self .update_mixer ()
0 commit comments