diff --git a/.config/scripts/control-panel.py b/.config/scripts/control-panel.py index a6d9352..ac4cf15 100755 --- a/.config/scripts/control-panel.py +++ b/.config/scripts/control-panel.py @@ -494,23 +494,16 @@ class Panel(Gtk.Window): return outer def build_audio_view(self): - outer = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12) + outer = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=16) head = Gtk.Box(spacing=8) - head.set_margin_bottom(2) back = Gtk.Button(label=f"{ICON['back']} Audio") back.get_style_context().add_class("rowbtn") back.connect("clicked", lambda *_: self.go("main")) head.pack_start(back, True, True, 0) outer.add(head) - - scroller = Gtk.ScrolledWindow() - scroller.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) - scroller.set_min_content_height(120) - scroller.set_max_content_height(520) - scroller.set_propagate_natural_height(True) - self.audio_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10) - scroller.add(self.audio_box) - outer.add(scroller) + # laid out like the home page: plain stacked cards, nothing scrolls + self.audio_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=16) + outer.add(self.audio_box) return outer def section(self, text): @@ -533,10 +526,14 @@ class Panel(Gtk.Window): t = Gtk.Label(label=desc, xalign=0) t.set_ellipsize(3) h.pack_start(t, True, True, 0) + if not available: + # a right-aligned tag, so ellipsis on a long name cannot eat it + tag = Gtk.Label(label="unplugged") + tag.get_style_context().add_class("subtle") + h.pack_end(tag, False, False, 0) b.add(h) if not available: b.get_style_context().add_class("unavail") - t.set_text(f"{desc} (unplugged)") b.connect("clicked", lambda *_: self.set_device(kind, name, node_id, available)) return b @@ -603,7 +600,7 @@ class Panel(Gtk.Window): for c in self.audio_box.get_children(): self.audio_box.remove(c) - card = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6) + card = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10) card.get_style_context().add_class("card") v, vm = vol_get() m, mm = mic_get() @@ -632,11 +629,19 @@ class Panel(Gtk.Window): apps = sink_inputs() if apps: self.audio_box.add(self.section("Applications")) - card = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6) + card = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10) card.get_style_context().add_class("card") for idx, app, vol, muted in apps: card.add(self.app_row(idx, app, vol, muted)) - self.audio_box.add(card) + if len(apps) > 4: # only a long list needs to scroll + sc = Gtk.ScrolledWindow() + sc.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) + sc.set_max_content_height(260) + sc.set_propagate_natural_height(True) + sc.add(card) + self.audio_box.add(sc) + else: + self.audio_box.add(card) self.audio_box.show_all() def on_map(self, *_):