From 221d0dde5549260c776d65a0b6a108cbabb391e3 Mon Sep 17 00:00:00 2001 From: The_miro Date: Mon, 6 Jul 2026 00:12:16 +0200 Subject: [PATCH] fix(astal-menu): keep toggle switches pill-shaped (valign center) Switches sat with the default FILL vertical alignment, so in taller rows (e.g. the Bluetooth Power switch in the expanded card's header) they stretched to the row height and rendered as a squared/vertical blob. Give every Gtk.Switch valign=CENTER so it keeps its fixed pill height regardless of the row. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01XUWCXM4KhjRkwheaA3X7bP --- desktopenvs/hyprlua/astal-menu/modules/bluetooth.py | 3 ++- desktopenvs/hyprlua/astal-menu/modules/network.py | 8 +++++--- desktopenvs/hyprlua/astal-menu/ui/quadcard.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/desktopenvs/hyprlua/astal-menu/modules/bluetooth.py b/desktopenvs/hyprlua/astal-menu/modules/bluetooth.py index b7d8f3b..b834ebd 100644 --- a/desktopenvs/hyprlua/astal-menu/modules/bluetooth.py +++ b/desktopenvs/hyprlua/astal-menu/modules/bluetooth.py @@ -70,7 +70,8 @@ class _BluetoothView(Gtk.Box): header.add_css_class("bt-header") left = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8) left.append(Gtk.Label(label="Power")) - self._power = Gtk.Switch(active=bool(self.bt and self.bt.get_is_powered())) + self._power = Gtk.Switch(active=bool(self.bt and self.bt.get_is_powered()), + valign=Gtk.Align.CENTER) self._power.connect("state-set", self._on_power) left.append(self._power) header.set_start_widget(left) diff --git a/desktopenvs/hyprlua/astal-menu/modules/network.py b/desktopenvs/hyprlua/astal-menu/modules/network.py index f6c8a99..16b631c 100644 --- a/desktopenvs/hyprlua/astal-menu/modules/network.py +++ b/desktopenvs/hyprlua/astal-menu/modules/network.py @@ -69,7 +69,8 @@ class _Compact(Gtk.Box): row.append(Gtk.Label(label="")) # nf wifi row.append(self._primary) wifi = self.net.get_wifi() if self.net else None - self._wifi_switch = Gtk.Switch(active=bool(wifi and wifi.get_enabled())) + self._wifi_switch = Gtk.Switch(active=bool(wifi and wifi.get_enabled()), + valign=Gtk.Align.CENTER) self._wifi_switch.set_tooltip_text("Wi-Fi") self._wifi_switch.connect("state-set", self._on_wifi_toggle) row.append(self._wifi_switch) @@ -149,7 +150,8 @@ class _IPSection(Gtk.Box): head.set_start_widget(Gtk.Label(label=title, xalign=0.0)) auto = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8) auto.append(Gtk.Label(label="Automatic")) - self._dhcp = Gtk.Switch(active=(fam_data.get("method", "auto") != "manual")) + self._dhcp = Gtk.Switch(active=(fam_data.get("method", "auto") != "manual"), + valign=Gtk.Align.CENTER) self._dhcp.connect("state-set", self._on_mode) auto.append(self._dhcp) head.set_end_widget(auto) @@ -434,7 +436,7 @@ class _DnsPage(Gtk.Box): self.append(_labeled("Servers", self._servers)) ignore = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8) ignore.append(Gtk.Label(label="Ignore automatic", hexpand=True, xalign=0.0)) - self._ignore = Gtk.Switch(active=True) + self._ignore = Gtk.Switch(active=True, valign=Gtk.Align.CENTER) ignore.append(self._ignore) self.append(ignore) self.append(_pill("Apply DNS", self._apply)) diff --git a/desktopenvs/hyprlua/astal-menu/ui/quadcard.py b/desktopenvs/hyprlua/astal-menu/ui/quadcard.py index b138107..93b1eb8 100644 --- a/desktopenvs/hyprlua/astal-menu/ui/quadcard.py +++ b/desktopenvs/hyprlua/astal-menu/ui/quadcard.py @@ -88,7 +88,7 @@ class QuadCard(Gtk.Box): row = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=12) row.add_css_class("switch-row") lbl = Gtk.Label(label=label, xalign=0.0, hexpand=True) - sw = Gtk.Switch(active=value) + sw = Gtk.Switch(active=value, valign=Gtk.Align.CENTER) sw.connect("state-set", lambda _sw, v: (on_change(v), False)[1]) row.append(lbl) row.append(sw)