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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XUWCXM4KhjRkwheaA3X7bPfeat/astal-menu
parent
0e8cdd5335
commit
221d0dde55
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue