diff --git a/Panel.qml b/Panel.qml index f569a21..6277f1c 100644 --- a/Panel.qml +++ b/Panel.qml @@ -403,18 +403,31 @@ Panel { anchors.fill: parent spacing: Style.space(4) - Text { + // A WidgetButton rather than a plain Text with a MouseArea, because + // WidgetButton registers itself in bar.clickTargets. That registration is + // what makes left-click work: while a panel is open, KeyboardPanel puts a + // full-screen overlay above everything and forwards clicks in the bar strip + // only to registered targets. An unregistered MouseArea would open the + // panel on press and then have the same click treated as "outside" and + // dismiss it — the panel appeared not to open at all. + WidgetButton { id: tailnetLabel visible: text !== "" + bar: root.bar text: root.tailnetName - // Brand yellow. Dimmed by opacity rather than by darkening the colour - // when Tailscale is off — Qt.darker on yellow slides the hue to olive - // instead of just quietening it, the same trap as the IP/DNS subtitle. - color: root.accent - opacity: tailscale.active ? 1.0 : 0.5 - font.family: root.fontFamily - font.pixelSize: Style.bar.iconFont + // Brand yellow. `dimmed` fades the whole button when Tailscale is off, + // rather than darkening the colour — Qt.darker on yellow slides the hue + // to olive instead of quietening it, the same trap as the IP/DNS line. + foreground: root.accent + useActiveColor: false + dimmed: !tailscale.active + fontSize: Style.bar.iconFont anchors.verticalCenter: parent.verticalCenter + onPressed: function(buttonCode) { + if (buttonCode === Qt.RightButton) tailscale.toggleOffscale() + else if (buttonCode === Qt.MiddleButton) tailscale.refresh() + else root.toggle() + } } BarIconButton {