launcher: better app items
Also config max shown Custom cursor for styled text field
This commit is contained in:
parent
bfffe0ccf7
commit
7cbfce800a
5 changed files with 94 additions and 17 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import Quickshell
|
|||
import QtQuick
|
||||
|
||||
Singleton {
|
||||
readonly property int maxShown: 8
|
||||
readonly property Sizes sizes: Sizes {}
|
||||
|
||||
component Sizes: QtObject {
|
||||
|
|
|
|||
53
modules/launcher/AppItem.qml
Normal file
53
modules/launcher/AppItem.qml
Normal file
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue