From 1c259d7878c00592916dc6acdb6e22771b22bbf1 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 12 Jul 2025 23:21:58 +0800 Subject: finish organize --- components/Icons.qml | 34 ++++++++++++++++++++++++++++++++++ components/SimpleResource.qml | 26 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 components/Icons.qml create mode 100644 components/SimpleResource.qml (limited to 'components') diff --git a/components/Icons.qml b/components/Icons.qml new file mode 100644 index 0000000..4b3915c --- /dev/null +++ b/components/Icons.qml @@ -0,0 +1,34 @@ +import QtQuick +import QtQuick.Layouts + +import qs.config + +Text { + id: root + property real iconSize: General.iconSize + property real fill: 0 + property real truncatedFill: Math.round(fill * 100) / 100 // Reduce memory consumption spikes from constant font remapping + renderType: Text.NativeRendering + font { + hintingPreference: Font.PreferFullHinting + family: Style.font.family.symbols ?? "Symbols Nerd Font" + pixelSize: iconSize + weight: Font.Normal + (Font.DemiBold - Font.Normal) * fill + variableAxes: { + "FILL": truncatedFill, + // "wght": font.weight, + // "GRAD": 0, + "opsz": iconSize + } + } + verticalAlignment: Text.AlignVCenter + // color: Style.m3colors.m3onBackground + + // Behavior on fill { + // NumberAnimation { + // duration: Appearance?.animation.elementMoveFast.duration ?? 200 + // easing.type: Appearance?.animation.elementMoveFast.type ?? Easing.BezierSpline + // easing.bezierCurve: Appearance?.animation.elementMoveFast.bezierCurve ?? [0.34, 0.80, 0.34, 1.00, 1, 1] + // } + // } +} diff --git a/components/SimpleResource.qml b/components/SimpleResource.qml new file mode 100644 index 0000000..786e37b --- /dev/null +++ b/components/SimpleResource.qml @@ -0,0 +1,26 @@ +import QtQuick +import Quickshell +import QtQuick.Layouts +import qs.config as Config +import qs.components + +RowLayout { + id: root + required property string text + required property string icon + Item { + Layout.fillWidth: true + } + anchors.fill: parent + spacing: Config.Bar.resourceIconTextSpacing + + Icons { + text: root.icon + } + Text { + text: root.text + } + Item { + Layout.fillWidth: true + } +} -- cgit v1.2.3