From 3f9383e3d122bba4c87120c56a8a7093730163cc Mon Sep 17 00:00:00 2001 From: Sarthak <118442597+sarthak1337-alt@users.noreply.github.com> Date: Fri, 4 Sep 2026 09:00:07 +0530 Subject: [PATCH] control panel: scope the enlarged icons to the slider buttons .rowbtn is shared by the audio device rows and the back button, so raising its font size enlarged the whole audio list. The speaker/mic buttons beside a slider now use their own .volbtn class; .rowbtn is back to 14px. The window also now shrinks to each view's natural size instead of keeping the tallest view's height. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Cn3dHfbgNYdbZvzb1b3GQt --- .config/scripts/control-panel.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.config/scripts/control-panel.py b/.config/scripts/control-panel.py index 18d486a..a6d9352 100755 --- a/.config/scripts/control-panel.py +++ b/.config/scripts/control-panel.py @@ -20,11 +20,11 @@ CSS = b""" /* Glyphs come from the Nerd Font. Without an explicit family, GTK uses the desktop font (Noto Sans), which lacks them, and Pango's per-glyph fallback picks a font that ignores the css colour - that is why icons rendered black. */ -.icon, .tile-icon, .pw, .rowbtn, .title, -.icon label, .pw label, .rowbtn label, .tile label { +.icon, .tile-icon, .pw, .rowbtn, .volbtn, .title, +.icon label, .pw label, .rowbtn label, .volbtn label, .tile label { font-family: "JetBrainsMono Nerd Font", "Symbols Nerd Font", monospace; } -.pw label, .rowbtn label { color: #e9eefb; } +.pw label, .rowbtn label, .volbtn label { color: #e9eefb; } .pw:hover label { color: #e9eefb; } window.panel { background-color: transparent; } @@ -74,9 +74,20 @@ window.panel { background-color: transparent; } border: none; border-radius: 10px; color: #e9eefb; - font-size: 19px; - padding: 9px 12px; + font-size: 14px; + padding: 10px 12px; } +/* only the speaker/mic buttons beside a slider, not every list row */ +.volbtn { + background-image: none; + background-color: transparent; + border: none; + border-radius: 10px; + color: #e9eefb; + font-size: 19px; + padding: 6px 10px; +} +.volbtn:hover { background-color: rgba(146, 185, 234, 0.17); } .rowbtn:hover { background-color: rgba(146, 185, 234, 0.17); } .rowbtn.chosen { background-color: rgba(146, 185, 234, 0.22); color: #cfe0f7; } .rowbtn.unavail { color: #6f6889; } @@ -441,7 +452,7 @@ class Panel(Gtk.Window): def slider_row(self, icon, on_change, on_click): row = Gtk.Box(spacing=10) btn = Gtk.Button(label=icon) - btn.get_style_context().add_class("rowbtn") + btn.get_style_context().add_class("volbtn") btn.connect("clicked", on_click) scale = Gtk.Scale.new_with_range(Gtk.Orientation.HORIZONTAL, 0, 100, 1) scale.set_draw_value(False) @@ -540,7 +551,7 @@ class Panel(Gtk.Window): muted_icon = {ICON["vol"]: ICON["vol_mute"], ICON["mic"]: ICON["mic_mute"]}.get(base, ICON["vol_mute"]) mb = Gtk.Button(label=muted_icon if muted else base) - mb.get_style_context().add_class("rowbtn") + mb.get_style_context().add_class("volbtn") mb.connect("clicked", lambda *_: ( sh(f"wpctl set-mute {idx} toggle" if wp else f"pactl set-sink-input-mute {idx} toggle"), @@ -653,6 +664,7 @@ class Panel(Gtk.Window): if name != "main": {"bt": self.fill_bt, "net": self.fill_net, "audio": self.fill_audio}[name]() self.stack.set_visible_child_name(name) + GLib.idle_add(lambda: (self.resize(1, 1), False)[1]) def on_key(self, _w, ev): if ev.keyval == Gdk.KEY_Escape: