diff options
Diffstat (limited to '')
| -rw-r--r-- | modules/toasts/ToastItem.qml (renamed from modules/utilities/toasts/ToastItem.qml) | 0 | ||||
| -rw-r--r-- | modules/toasts/Toasts.qml (renamed from modules/utilities/toasts/Toasts.qml) | 6 | ||||
| -rw-r--r-- | modules/utilities/Background.qml | 55 | ||||
| -rw-r--r-- | modules/utilities/Content.qml | 27 | ||||
| -rw-r--r-- | modules/utilities/Wrapper.qml | 92 | ||||
| -rw-r--r-- | modules/utilities/cards/Toggles.qml | 162 |
6 files changed, 3 insertions, 339 deletions
diff --git a/modules/utilities/toasts/ToastItem.qml b/modules/toasts/ToastItem.qml index f475500..f475500 100644 --- a/modules/utilities/toasts/ToastItem.qml +++ b/modules/toasts/ToastItem.qml diff --git a/modules/utilities/toasts/Toasts.qml b/modules/toasts/Toasts.qml index 2915404..28328f5 100644 --- a/modules/utilities/toasts/Toasts.qml +++ b/modules/toasts/Toasts.qml @@ -12,7 +12,7 @@ Item { readonly property int spacing: Appearance.spacing.small property bool flag - implicitWidth: Config.utilities.sizes.toastWidth - Appearance.padding.normal * 2 + implicitWidth: 430 - Appearance.padding.normal * 2 implicitHeight: { let h = -spacing; for (let i = 0; i < repeater.count; i++) { @@ -34,7 +34,7 @@ Item { toasts.push(toast); if (!toast.closed) { count++; - if (count > Config.utilities.maxToasts) + if (count > 5) break; } } @@ -57,7 +57,7 @@ Item { for (let i = 0; i < index; i++) if (Toaster.toasts[i].closed) extraHidden++; - return index >= Config.utilities.maxToasts + extraHidden; + return index >= 5 + extraHidden; } onPreviewHiddenChanged: { diff --git a/modules/utilities/Background.qml b/modules/utilities/Background.qml deleted file mode 100644 index fbce896..0000000 --- a/modules/utilities/Background.qml +++ /dev/null @@ -1,55 +0,0 @@ -import qs.components -import qs.services -import qs.config -import QtQuick -import QtQuick.Shapes - -ShapePath { - id: root - - required property Wrapper wrapper - required property var sidebar - readonly property real rounding: Config.border.rounding - readonly property bool flatten: wrapper.height < rounding * 2 - readonly property real roundingY: flatten ? wrapper.height / 2 : rounding - - strokeWidth: -1 - fillColor: Colours.palette.m3surface - - PathLine { - relativeX: -(root.wrapper.width + root.rounding) - relativeY: 0 - } - PathArc { - relativeX: root.rounding - relativeY: -root.roundingY - radiusX: root.rounding - radiusY: Math.min(root.rounding, root.wrapper.height) - direction: PathArc.Counterclockwise - } - PathLine { - relativeX: 0 - relativeY: -(root.wrapper.height - root.roundingY * 2) - } - PathArc { - relativeX: root.sidebar.utilsRoundingX - relativeY: -root.roundingY - radiusX: root.sidebar.utilsRoundingX - radiusY: Math.min(root.rounding, root.wrapper.height) - } - PathLine { - relativeX: root.wrapper.height > 0 ? root.wrapper.width - root.rounding - root.sidebar.utilsRoundingX : root.wrapper.width - relativeY: 0 - } - PathArc { - relativeX: root.rounding - relativeY: -root.rounding - radiusX: root.rounding - radiusY: root.rounding - direction: PathArc.Counterclockwise - } - - Behavior on fillColor { - CAnim {} - } -} diff --git a/modules/utilities/Content.qml b/modules/utilities/Content.qml deleted file mode 100644 index 770a774..0000000 --- a/modules/utilities/Content.qml +++ /dev/null @@ -1,27 +0,0 @@ -import "cards" -import qs.config -import QtQuick -import QtQuick.Layouts - -Item { - id: root - - required property var props - required property var visibilities - required property Item popouts - - implicitWidth: layout.implicitWidth - implicitHeight: layout.implicitHeight - - ColumnLayout { - id: layout - - anchors.fill: parent - spacing: Appearance.spacing.normal - - Toggles { - visibilities: root.visibilities - popouts: root.popouts - } - } -} diff --git a/modules/utilities/Wrapper.qml b/modules/utilities/Wrapper.qml deleted file mode 100644 index 455b5fa..0000000 --- a/modules/utilities/Wrapper.qml +++ /dev/null @@ -1,92 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components -import qs.config -import Quickshell -import QtQuick - -Item { - id: root - - required property var visibilities - required property Item sidebar - required property Item popouts - - readonly property PersistentProperties props: PersistentProperties { - reloadableId: "utilities" - } - readonly property bool shouldBeActive: visibilities.sidebar || (visibilities.utilities && Config.utilities.enabled && !(visibilities.session && Config.session.enabled)) - - visible: height > 0 - implicitHeight: 0 - implicitWidth: sidebar.visible ? sidebar.width : Config.utilities.sizes.width - - onStateChanged: { - if (state === "visible" && timer.running) { - timer.triggered(); - timer.stop(); - } - } - - states: State { - name: "visible" - when: root.shouldBeActive - - PropertyChanges { - root.implicitHeight: content.implicitHeight + Appearance.padding.large * 2 - } - } - - transitions: [ - Transition { - from: "" - to: "visible" - - Anim { - target: root - property: "implicitHeight" - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - }, - Transition { - from: "visible" - to: "" - - Anim { - target: root - property: "implicitHeight" - easing.bezierCurve: Appearance.anim.curves.emphasized - } - } - ] - - Timer { - id: timer - - running: true - interval: Appearance.anim.durations.extraLarge - onTriggered: { - content.active = Qt.binding(() => root.shouldBeActive || root.visible); - content.visible = true; - } - } - - Loader { - id: content - - anchors.top: parent.top - anchors.left: parent.left - anchors.margins: Appearance.padding.large - - visible: false - active: true - - sourceComponent: Content { - implicitWidth: root.implicitWidth - Appearance.padding.large * 2 - props: root.props - visibilities: root.visibilities - popouts: root.popouts - } - } -} diff --git a/modules/utilities/cards/Toggles.qml b/modules/utilities/cards/Toggles.qml deleted file mode 100644 index b8aea6a..0000000 --- a/modules/utilities/cards/Toggles.qml +++ /dev/null @@ -1,162 +0,0 @@ -import qs.components -import qs.components.controls -import qs.services -import qs.config -import qs.modules.controlcenter -import Quickshell -import Quickshell.Bluetooth -import QtQuick -import QtQuick.Layouts - -StyledRect { - id: root - - required property var visibilities - required property Item popouts - - readonly property var quickToggles: { - const seenIds = new Set(); - - return Config.utilities.quickToggles.filter(item => { - if (!item.enabled) - return false; - - if (seenIds.has(item.id)) { - return false; - } - - if (item.id === "vpn") { - return Config.utilities.vpn.provider.some(p => - typeof p === "object" ? (p.enabled === true) : false - ); - } - - seenIds.add(item.id); - return true; - }); - } - readonly property int splitIndex: Math.ceil(quickToggles.length / 2) - readonly property bool needExtraRow: quickToggles.length > 6 - - Layout.fillWidth: true - implicitHeight: layout.implicitHeight + Appearance.padding.large * 2 - - radius: Appearance.rounding.normal - color: Colours.tPalette.m3surfaceContainer - - ColumnLayout { - id: layout - - anchors.fill: parent - anchors.margins: Appearance.padding.large - spacing: Appearance.spacing.normal - - StyledText { - text: qsTr("Quick Toggles") - font.pointSize: Appearance.font.size.normal - } - - ToggleRow { - rowModel: root.needExtraRow ? root.quickToggles.slice(0, root.splitIndex) : root.quickToggles - } - - ToggleRow { - visible: root.needExtraRow - rowModel: root.needExtraRow ? root.quickToggles.slice(root.splitIndex) : [] - } - } - - component ToggleRow: RowLayout { - property var rowModel: [] - - Layout.fillWidth: true - spacing: Appearance.spacing.small - - Repeater { - model: parent.rowModel - - delegate: DelegateChooser { - role: "id" - - DelegateChoice { - roleValue: "wifi" - delegate: Toggle { - icon: "wifi" - checked: Nmcli.wifiEnabled - onClicked: Nmcli.toggleWifi() - } - } - DelegateChoice { - roleValue: "bluetooth" - delegate: Toggle { - icon: "bluetooth" - checked: Bluetooth.defaultAdapter?.enabled ?? false - onClicked: { - const adapter = Bluetooth.defaultAdapter; - if (adapter) - adapter.enabled = !adapter.enabled; - } - } - } - DelegateChoice { - roleValue: "mic" - delegate: Toggle { - icon: "mic" - checked: !Audio.sourceMuted - onClicked: { - const audio = Audio.source?.audio; - if (audio) - audio.muted = !audio.muted; - } - } - } - DelegateChoice { - roleValue: "settings" - delegate: Toggle { - icon: "settings" - inactiveOnColour: Colours.palette.m3onSurfaceVariant - toggle: false - onClicked: { - root.visibilities.utilities = false; - root.popouts.detach("network"); - } - } - } - DelegateChoice { - roleValue: "dnd" - delegate: Toggle { - icon: "notifications_off" - checked: Notifs.dnd - onClicked: Notifs.dnd = !Notifs.dnd - } - } - DelegateChoice { - roleValue: "vpn" - delegate: Toggle { - icon: "vpn_key" - checked: VPN.connected - enabled: !VPN.connecting - onClicked: VPN.toggle() - } - } - } - } - } - - component Toggle: IconButton { - Layout.fillWidth: true - Layout.preferredWidth: implicitWidth + (stateLayer.pressed ? Appearance.padding.large : internalChecked ? Appearance.padding.smaller : 0) - radius: stateLayer.pressed ? Appearance.rounding.small / 2 : internalChecked ? Appearance.rounding.small : Appearance.rounding.normal - inactiveColour: Colours.layer(Colours.palette.m3surfaceContainerHighest, 2) - toggle: true - radiusAnim.duration: Appearance.anim.durations.expressiveFastSpatial - radiusAnim.easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial - - Behavior on Layout.preferredWidth { - Anim { - duration: Appearance.anim.durations.expressiveFastSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial - } - } - } -} |