summaryrefslogtreecommitdiff
path: root/modules/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'modules/utilities')
-rw-r--r--modules/utilities/Background.qml55
-rw-r--r--modules/utilities/Content.qml27
-rw-r--r--modules/utilities/Wrapper.qml92
-rw-r--r--modules/utilities/cards/Toggles.qml162
-rw-r--r--modules/utilities/toasts/ToastItem.qml135
-rw-r--r--modules/utilities/toasts/Toasts.qml143
6 files changed, 0 insertions, 614 deletions
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
- }
- }
- }
-}
diff --git a/modules/utilities/toasts/ToastItem.qml b/modules/utilities/toasts/ToastItem.qml
deleted file mode 100644
index f475500..0000000
--- a/modules/utilities/toasts/ToastItem.qml
+++ /dev/null
@@ -1,135 +0,0 @@
-import qs.components
-import qs.components.effects
-import qs.services
-import qs.config
-import Caelestia
-import QtQuick
-import QtQuick.Layouts
-
-StyledRect {
- id: root
-
- required property Toast modelData
-
- anchors.left: parent.left
- anchors.right: parent.right
- implicitHeight: layout.implicitHeight + Appearance.padding.smaller * 2
-
- radius: Appearance.rounding.normal
- color: {
- if (root.modelData.type === Toast.Success)
- return Colours.palette.m3successContainer;
- if (root.modelData.type === Toast.Warning)
- return Colours.palette.m3secondary;
- if (root.modelData.type === Toast.Error)
- return Colours.palette.m3errorContainer;
- return Colours.palette.m3surface;
- }
-
- border.width: 1
- border.color: {
- let colour = Colours.palette.m3outlineVariant;
- if (root.modelData.type === Toast.Success)
- colour = Colours.palette.m3success;
- if (root.modelData.type === Toast.Warning)
- colour = Colours.palette.m3secondaryContainer;
- if (root.modelData.type === Toast.Error)
- colour = Colours.palette.m3error;
- return Qt.alpha(colour, 0.3);
- }
-
- Elevation {
- anchors.fill: parent
- radius: parent.radius
- opacity: parent.opacity
- z: -1
- level: 3
- }
-
- RowLayout {
- id: layout
-
- anchors.fill: parent
- anchors.margins: Appearance.padding.smaller
- anchors.leftMargin: Appearance.padding.normal
- anchors.rightMargin: Appearance.padding.normal
- spacing: Appearance.spacing.normal
-
- StyledRect {
- radius: Appearance.rounding.normal
- color: {
- if (root.modelData.type === Toast.Success)
- return Colours.palette.m3success;
- if (root.modelData.type === Toast.Warning)
- return Colours.palette.m3secondaryContainer;
- if (root.modelData.type === Toast.Error)
- return Colours.palette.m3error;
- return Colours.palette.m3surfaceContainerHigh;
- }
-
- implicitWidth: implicitHeight
- implicitHeight: icon.implicitHeight + Appearance.padding.smaller * 2
-
- MaterialIcon {
- id: icon
-
- anchors.centerIn: parent
- text: root.modelData.icon
- color: {
- if (root.modelData.type === Toast.Success)
- return Colours.palette.m3onSuccess;
- if (root.modelData.type === Toast.Warning)
- return Colours.palette.m3onSecondaryContainer;
- if (root.modelData.type === Toast.Error)
- return Colours.palette.m3onError;
- return Colours.palette.m3onSurfaceVariant;
- }
- font.pointSize: Math.round(Appearance.font.size.large * 1.2)
- }
- }
-
- ColumnLayout {
- Layout.fillWidth: true
- spacing: 0
-
- StyledText {
- id: title
-
- Layout.fillWidth: true
- text: root.modelData.title
- color: {
- if (root.modelData.type === Toast.Success)
- return Colours.palette.m3onSuccessContainer;
- if (root.modelData.type === Toast.Warning)
- return Colours.palette.m3onSecondary;
- if (root.modelData.type === Toast.Error)
- return Colours.palette.m3onErrorContainer;
- return Colours.palette.m3onSurface;
- }
- font.pointSize: Appearance.font.size.normal
- elide: Text.ElideRight
- }
-
- StyledText {
- Layout.fillWidth: true
- textFormat: Text.StyledText
- text: root.modelData.message
- color: {
- if (root.modelData.type === Toast.Success)
- return Colours.palette.m3onSuccessContainer;
- if (root.modelData.type === Toast.Warning)
- return Colours.palette.m3onSecondary;
- if (root.modelData.type === Toast.Error)
- return Colours.palette.m3onErrorContainer;
- return Colours.palette.m3onSurface;
- }
- opacity: 0.8
- elide: Text.ElideRight
- }
- }
- }
-
- Behavior on border.color {
- CAnim {}
- }
-}
diff --git a/modules/utilities/toasts/Toasts.qml b/modules/utilities/toasts/Toasts.qml
deleted file mode 100644
index 2915404..0000000
--- a/modules/utilities/toasts/Toasts.qml
+++ /dev/null
@@ -1,143 +0,0 @@
-pragma ComponentBehavior: Bound
-
-import qs.components
-import qs.config
-import Caelestia
-import Quickshell
-import QtQuick
-
-Item {
- id: root
-
- readonly property int spacing: Appearance.spacing.small
- property bool flag
-
- implicitWidth: Config.utilities.sizes.toastWidth - Appearance.padding.normal * 2
- implicitHeight: {
- let h = -spacing;
- for (let i = 0; i < repeater.count; i++) {
- const item = repeater.itemAt(i) as ToastWrapper;
- if (!item.modelData.closed && !item.previewHidden)
- h += item.implicitHeight + spacing;
- }
- return h;
- }
-
- Repeater {
- id: repeater
-
- model: ScriptModel {
- values: {
- const toasts = [];
- let count = 0;
- for (const toast of Toaster.toasts) {
- toasts.push(toast);
- if (!toast.closed) {
- count++;
- if (count > Config.utilities.maxToasts)
- break;
- }
- }
- return toasts;
- }
- onValuesChanged: root.flagChanged()
- }
-
- ToastWrapper {}
- }
-
- component ToastWrapper: MouseArea {
- id: toast
-
- required property int index
- required property Toast modelData
-
- readonly property bool previewHidden: {
- let extraHidden = 0;
- for (let i = 0; i < index; i++)
- if (Toaster.toasts[i].closed)
- extraHidden++;
- return index >= Config.utilities.maxToasts + extraHidden;
- }
-
- onPreviewHiddenChanged: {
- if (initAnim.running && previewHidden)
- initAnim.stop();
- }
-
- opacity: modelData.closed || previewHidden ? 0 : 1
- scale: modelData.closed || previewHidden ? 0.7 : 1
-
- anchors.bottomMargin: {
- root.flag; // Force update
- let y = 0;
- for (let i = 0; i < index; i++) {
- const item = repeater.itemAt(i) as ToastWrapper;
- if (item && !item.modelData.closed && !item.previewHidden)
- y += item.implicitHeight + root.spacing;
- }
- return y;
- }
-
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- implicitHeight: toastInner.implicitHeight
-
- acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
- onClicked: modelData.close()
-
- Component.onCompleted: modelData.lock(this)
-
- Anim {
- id: initAnim
-
- Component.onCompleted: running = !toast.previewHidden
-
- target: toast
- properties: "opacity,scale"
- from: 0
- to: 1
- duration: Appearance.anim.durations.expressiveDefaultSpatial
- easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
- }
-
- ParallelAnimation {
- running: toast.modelData.closed
- onStarted: toast.anchors.bottomMargin = toast.anchors.bottomMargin
- onFinished: toast.modelData.unlock(toast)
-
- Anim {
- target: toast
- property: "opacity"
- to: 0
- }
- Anim {
- target: toast
- property: "scale"
- to: 0.7
- }
- }
-
- ToastItem {
- id: toastInner
-
- modelData: toast.modelData
- }
-
- Behavior on opacity {
- Anim {}
- }
-
- Behavior on scale {
- Anim {}
- }
-
- Behavior on anchors.bottomMargin {
- Anim {
- duration: Appearance.anim.durations.expressiveDefaultSpatial
- easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
- }
- }
- }
-}