diff options
| -rw-r--r-- | config/Appearance.qml | 2 | ||||
| -rw-r--r-- | config/LauncherConfig.qml | 1 | ||||
| -rw-r--r-- | modules/launcher/AppItem.qml | 53 | ||||
| -rw-r--r-- | modules/launcher/Content.qml | 17 | ||||
| -rw-r--r-- | widgets/StyledTextField.qml | 38 |
5 files changed, 94 insertions, 17 deletions
diff --git a/config/Appearance.qml b/config/Appearance.qml index dcd1308..728021d 100644 --- a/config/Appearance.qml +++ b/config/Appearance.qml @@ -23,7 +23,7 @@ Singleton { return c; c = Qt.rgba(c.r, c.g, c.b, layer ? transparency.layers : transparency.base); if (layer) - c.hsvValue = Math.max(0, Math.min(1, c.hslLightness + (light ? -0.2 : 0.2))); + c.hsvValue = Math.max(0, Math.min(1, c.hslLightness + (light ? -0.2 : 0.2))); // TODO: edit based on colours (hue or smth) return c; } diff --git a/config/LauncherConfig.qml b/config/LauncherConfig.qml index 1b9efc0..caa3bc5 100644 --- a/config/LauncherConfig.qml +++ b/config/LauncherConfig.qml @@ -4,6 +4,7 @@ import Quickshell import QtQuick Singleton { + readonly property int maxShown: 8 readonly property Sizes sizes: Sizes {} component Sizes: QtObject { diff --git a/modules/launcher/AppItem.qml b/modules/launcher/AppItem.qml new file mode 100644 index 0000000..24e0470 --- /dev/null +++ b/modules/launcher/AppItem.qml @@ -0,0 +1,53 @@ +import "root:/widgets" +import "root:/config" +import Quickshell +import Quickshell.Widgets +import QtQuick + +PaddedRect { + id: root + + required property DesktopEntry modelData + + implicitWidth: ListView.view.width + padding: [Appearance.padding.smaller, Appearance.padding.normal] + radius: Appearance.rounding.normal + color: Appearance.alpha(Appearance.colours.m3surfaceContainerHighest, true) + + IconImage { + id: icon + + source: Quickshell.iconPath(root.modelData.icon) + implicitSize: parent.height * 0.8 + + anchors.verticalCenter: parent.verticalCenter + } + + Item { + anchors.left: icon.right + anchors.leftMargin: Appearance.spacing.normal + anchors.verticalCenter: icon.verticalCenter + + implicitWidth: parent.width - icon.width + implicitHeight: childrenRect.height + + StyledText { + id: name + + text: root.modelData.name + font.pointSize: Appearance.font.size.normal + } + + StyledText { + text: root.modelData.comment + // font.family: Appearance.font.family.mono + font.pointSize: Appearance.font.size.small + color: Appearance.alpha(Appearance.colours.m3outline, true) + + elide: Text.ElideRight + width: root.width - icon.width - Appearance.rounding.normal * 2 + + anchors.top: name.bottom + } + } +} diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml index 5f99345..a41fca4 100644 --- a/modules/launcher/Content.qml +++ b/modules/launcher/Content.qml @@ -37,27 +37,14 @@ Item { spacing: Appearance.spacing.small orientation: Qt.Vertical verticalLayoutDirection: Qt.BottomToTop - implicitHeight: ((currentItem?.height ?? 1) + spacing) * Math.min(10, count) - spacing + implicitHeight: ((currentItem?.height ?? 1) + spacing) * Math.min(LauncherConfig.maxShown, count) - spacing anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: Appearance.padding.large - delegate: PaddedRect { - id: entry - - required property DesktopEntry modelData - - radius: Appearance.rounding.normal - color: Appearance.alpha(Appearance.colours.m3surfaceContainerHighest, true) - - StyledText { - text: modelData.name - font.family: Appearance.font.family.sans - font.pointSize: Appearance.font.size.smaller - } - } + delegate: AppItem {} add: Transition { Anim { diff --git a/widgets/StyledTextField.qml b/widgets/StyledTextField.qml index f6232f2..cb1ce83 100644 --- a/widgets/StyledTextField.qml +++ b/widgets/StyledTextField.qml @@ -7,12 +7,48 @@ import QtQuick.Controls TextField { id: root - renderType: TextField.NativeRendering color: Appearance.colours.m3onSurface placeholderTextColor: Appearance.colours.m3outline font.family: Appearance.font.family.sans font.pointSize: Appearance.font.size.smaller + cursorDelegate: StyledRect { + id: cursor + + property bool disableBlink + + implicitWidth: 2 + color: Appearance.colours.m3primary + radius: Appearance.rounding.normal + onXChanged: { + opacity = 1; + disableBlink = true; + enableBlink.start(); + } + + Timer { + id: enableBlink + + interval: 100 + onTriggered: cursor.disableBlink = false + } + + Timer { + running: root.cursorVisible && !cursor.disableBlink + repeat: true + interval: 500 + onTriggered: parent.opacity = parent.opacity === 1 ? 0 : 1 + } + + Behavior on opacity { + NumberAnimation { + duration: Appearance.anim.durations.small + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } + } + Behavior on color { ColorAnimation { duration: Appearance.anim.durations.normal |