From 982a5a3e8de4abb322b53ea0bf77b5e57860540f Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 23 Jul 2025 23:04:28 +1000 Subject: dcontent: create bluetooth panel --- modules/bar/popouts/Background.qml | 2 +- modules/bar/popouts/Bluetooth.qml | 38 ++++++++++++++++++++++++++++++++++++++ modules/bar/popouts/Content.qml | 4 +++- modules/bar/popouts/Wrapper.qml | 22 +++++++++++++++++++++- 4 files changed, 63 insertions(+), 3 deletions(-) (limited to 'modules/bar') diff --git a/modules/bar/popouts/Background.qml b/modules/bar/popouts/Background.qml index f7d568f..14f5f20 100644 --- a/modules/bar/popouts/Background.qml +++ b/modules/bar/popouts/Background.qml @@ -8,7 +8,7 @@ ShapePath { required property Wrapper wrapper required property bool invertBottomRounding - readonly property real rounding: Config.border.rounding + readonly property real rounding: wrapper.isDetached ? Appearance.rounding.normal : Config.border.rounding readonly property bool flatten: wrapper.width < rounding * 2 readonly property real roundingX: flatten ? wrapper.width / 2 : rounding property real ibr: invertBottomRounding ? -1 : 1 diff --git a/modules/bar/popouts/Bluetooth.qml b/modules/bar/popouts/Bluetooth.qml index 5b1127f..56dd4a4 100644 --- a/modules/bar/popouts/Bluetooth.qml +++ b/modules/bar/popouts/Bluetooth.qml @@ -12,6 +12,8 @@ import QtQuick.Layouts ColumnLayout { id: root + required property Item wrapper + spacing: Appearance.spacing.small StyledText { @@ -170,6 +172,42 @@ ColumnLayout { } } + StyledRect { + Layout.topMargin: Appearance.spacing.small + implicitWidth: expandBtn.implicitWidth + Appearance.padding.normal * 2 + implicitHeight: expandBtn.implicitHeight + Appearance.padding.small + + radius: Appearance.rounding.normal + color: Colours.palette.m3primaryContainer + + StateLayer { + color: Colours.palette.m3onPrimaryContainer + + function onClicked(): void { + root.wrapper.detach("bluetooth"); + } + } + + RowLayout { + id: expandBtn + + anchors.centerIn: parent + spacing: Appearance.spacing.small + + StyledText { + Layout.leftMargin: Appearance.padding.smaller + text: qsTr("Open panel") + color: Colours.palette.m3onPrimaryContainer + } + + MaterialIcon { + text: "chevron_right" + color: Colours.palette.m3onPrimaryContainer + font.pointSize: Appearance.font.size.large + } + } + } + component Toggle: RowLayout { required property string label property alias checked: toggle.checked diff --git a/modules/bar/popouts/Content.qml b/modules/bar/popouts/Content.qml index 684f702..42e138d 100644 --- a/modules/bar/popouts/Content.qml +++ b/modules/bar/popouts/Content.qml @@ -35,7 +35,9 @@ Item { Popout { name: "bluetooth" - source: "Bluetooth.qml" + sourceComponent: Bluetooth { + wrapper: root.wrapper + } } Popout { diff --git a/modules/bar/popouts/Wrapper.qml b/modules/bar/popouts/Wrapper.qml index 293f9d5..9a7f7c1 100644 --- a/modules/bar/popouts/Wrapper.qml +++ b/modules/bar/popouts/Wrapper.qml @@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound import qs.services import qs.config import qs.modules.windowinfo +import qs.modules.detachedcontent import Quickshell import Quickshell.Wayland import Quickshell.Hyprland @@ -21,6 +22,7 @@ Item { property bool hasCurrent property string detachedMode + property string queuedMode readonly property bool isDetached: detachedMode.length > 0 property int animLength: Appearance.anim.durations.normal @@ -28,7 +30,12 @@ Item { function detach(mode: string): void { animLength = Appearance.anim.durations.large; - detachedMode = mode; + if (mode === "winfo") { + detachedMode = mode; + } else { + detachedMode = "any"; + queuedMode = mode; + } focus = true; } @@ -86,6 +93,19 @@ Item { } } + Comp { + id: detachedContent + + shouldBeActive: root.detachedMode === "any" + asynchronous: true + anchors.centerIn: parent + + sourceComponent: DetachedContent { + screen: root.screen + active: root.queuedMode + } + } + Behavior on x { Anim { duration: root.animLength -- cgit v1.2.3-freya