diff options
| -rw-r--r-- | modules/launcher/ActionItem.qml | 60 | ||||
| -rw-r--r-- | modules/launcher/AppItem.qml | 58 | ||||
| -rw-r--r-- | widgets/PaddedRect.qml | 52 |
3 files changed, 65 insertions, 105 deletions
diff --git a/modules/launcher/ActionItem.qml b/modules/launcher/ActionItem.qml index f4f7e2f..800c937 100644 --- a/modules/launcher/ActionItem.qml +++ b/modules/launcher/ActionItem.qml @@ -3,59 +3,65 @@ import "root:/services" import "root:/config" import QtQuick -PaddedRect { +Item { id: root required property Actions.Action modelData required property var list implicitHeight: LauncherConfig.sizes.itemHeight - padding: [Appearance.padding.smaller, Appearance.padding.larger] anchors.left: parent.left anchors.right: parent.right StateLayer { - radius: Appearance.rounding.normal + radius: Appearance.rounding.full function onClicked(): void { root.modelData.onClicked(root.list); } } - MaterialIcon { - id: icon + Item { + anchors.fill: parent + anchors.leftMargin: Appearance.padding.larger + anchors.rightMargin: Appearance.padding.larger + anchors.margins: Appearance.padding.smaller - text: root.modelData.icon - font.pointSize: Appearance.font.size.extraLarge + MaterialIcon { + id: icon - anchors.verticalCenter: parent.verticalCenter - } + text: root.modelData.icon + font.pointSize: Appearance.font.size.extraLarge - Item { - anchors.left: icon.right - anchors.leftMargin: Appearance.spacing.larger - anchors.verticalCenter: icon.verticalCenter + anchors.verticalCenter: parent.verticalCenter + } - implicitWidth: parent.width - icon.width - implicitHeight: childrenRect.height + Item { + anchors.left: icon.right + anchors.leftMargin: Appearance.spacing.larger + anchors.verticalCenter: icon.verticalCenter - StyledText { - id: name + implicitWidth: parent.width - icon.width + implicitHeight: childrenRect.height - text: root.modelData.name - font.pointSize: Appearance.font.size.normal - } + StyledText { + id: name + + text: root.modelData.name + font.pointSize: Appearance.font.size.normal + } - StyledText { - text: root.modelData.desc - font.pointSize: Appearance.font.size.small - color: Colours.alpha(Colours.palette.m3outline, true) + StyledText { + text: root.modelData.desc + font.pointSize: Appearance.font.size.small + color: Colours.alpha(Colours.palette.m3outline, true) - elide: Text.ElideRight - width: root.width - icon.width - Appearance.rounding.normal * 2 + elide: Text.ElideRight + width: root.width - icon.width - Appearance.rounding.normal * 2 - anchors.top: name.bottom + anchors.top: name.bottom + } } } } diff --git a/modules/launcher/AppItem.qml b/modules/launcher/AppItem.qml index 1c4b691..ab815ab 100644 --- a/modules/launcher/AppItem.qml +++ b/modules/launcher/AppItem.qml @@ -5,14 +5,13 @@ import Quickshell import Quickshell.Widgets import QtQuick -PaddedRect { +Item { id: root required property DesktopEntry modelData required property PersistentProperties visibilities implicitHeight: LauncherConfig.sizes.itemHeight - padding: [Appearance.padding.smaller, Appearance.padding.normal] anchors.left: parent.left anchors.right: parent.right @@ -26,39 +25,46 @@ PaddedRect { } } - IconImage { - id: icon + Item { + anchors.fill: parent + anchors.leftMargin: Appearance.padding.larger + anchors.rightMargin: Appearance.padding.larger + anchors.margins: Appearance.padding.smaller - source: Quickshell.iconPath(root.modelData.icon, "image-missing") - implicitSize: parent.height * 0.8 + IconImage { + id: icon - anchors.verticalCenter: parent.verticalCenter - } + source: Quickshell.iconPath(root.modelData.icon, "image-missing") + implicitSize: parent.height * 0.8 - Item { - anchors.left: icon.right - anchors.leftMargin: Appearance.spacing.normal - anchors.verticalCenter: icon.verticalCenter + anchors.verticalCenter: parent.verticalCenter + } - implicitWidth: parent.width - icon.width - implicitHeight: childrenRect.height + Item { + anchors.left: icon.right + anchors.leftMargin: Appearance.spacing.normal + anchors.verticalCenter: icon.verticalCenter - StyledText { - id: name + implicitWidth: parent.width - icon.width + implicitHeight: childrenRect.height - text: root.modelData.name - font.pointSize: Appearance.font.size.normal - } + StyledText { + id: name + + text: root.modelData.name + font.pointSize: Appearance.font.size.normal + } - StyledText { - text: root.modelData.comment || root.modelData.genericName || root.modelData.name - font.pointSize: Appearance.font.size.small - color: Colours.alpha(Colours.palette.m3outline, true) + StyledText { + text: root.modelData.comment || root.modelData.genericName || root.modelData.name + font.pointSize: Appearance.font.size.small + color: Colours.alpha(Colours.palette.m3outline, true) - elide: Text.ElideRight - width: root.width - icon.width - Appearance.rounding.normal * 2 + elide: Text.ElideRight + width: root.width - icon.width - Appearance.rounding.normal * 2 - anchors.top: name.bottom + anchors.top: name.bottom + } } } } diff --git a/widgets/PaddedRect.qml b/widgets/PaddedRect.qml deleted file mode 100644 index 0ce1f16..0000000 --- a/widgets/PaddedRect.qml +++ /dev/null @@ -1,52 +0,0 @@ -import "root:/config" -import QtQuick - -StyledRect { - id: root - - property var padding: 0 - - readonly property real paddingTop: getRealPadding().top - readonly property real paddingRight: getRealPadding().right - readonly property real paddingBottom: getRealPadding().bottom - readonly property real paddingLeft: getRealPadding().left - readonly property real paddingX: getRealPadding().x - readonly property real paddingY: getRealPadding().y - - function getRealPadding() { - const pad = {}; - - if (Array.isArray(padding)) { - if (padding.length === 2) { - pad.top = pad.bottom = padding[0]; - pad.left = pad.right = padding[1]; - } else if (padding.length === 3) { - pad.top = padding[0]; - pad.left = pad.right = padding[1]; - pad.bottom = padding[2]; - } else if (padding.length === 4) { - pad.top = padding[0]; - pad.right = padding[1]; - pad.bottom = padding[2]; - pad.left = padding[3]; - } - } else { - pad.top = pad.bottom = pad.left = pad.right = padding; - } - - pad.x = pad.left + pad.right; - pad.y = pad.top + pad.bottom; - - return pad; - } - - implicitWidth: childrenRect.width + paddingX - implicitHeight: childrenRect.height + paddingY - - onChildrenChanged: { - for (const child of children) { - child.x = Qt.binding(() => paddingLeft); - child.y = Qt.binding(() => paddingTop); - } - } -} |