From 03a93a60a6c425f5e881bed01feddf7f755624a7 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 13 Jul 2025 22:44:02 +0800 Subject: refactor: icons -> icon components --- components/Icon.qml | 35 +++++++++++++++++++++++++++++++++++ components/Icons.qml | 35 ----------------------------------- components/SimpleResource.qml | 14 +++++++------- 3 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 components/Icon.qml delete mode 100644 components/Icons.qml (limited to 'components') diff --git a/components/Icon.qml b/components/Icon.qml new file mode 100644 index 0000000..a5d2348 --- /dev/null +++ b/components/Icon.qml @@ -0,0 +1,35 @@ +import QtQuick +import QtQuick.Layouts + +import qs.config + +IText { + 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 + hintingPreference: Font.PreferNoHinting // so the icons dont just offset away + 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/Icons.qml b/components/Icons.qml deleted file mode 100644 index a5d2348..0000000 --- a/components/Icons.qml +++ /dev/null @@ -1,35 +0,0 @@ -import QtQuick -import QtQuick.Layouts - -import qs.config - -IText { - 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 - hintingPreference: Font.PreferNoHinting // so the icons dont just offset away - 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 index 0069f53..4df395d 100644 --- a/components/SimpleResource.qml +++ b/components/SimpleResource.qml @@ -1,7 +1,7 @@ import QtQuick import Quickshell import QtQuick.Layouts -import qs.config as Config +import qs.config import qs.components Item { @@ -15,23 +15,23 @@ Item { Rectangle { id: container - implicitWidth: layout.implicitWidth + Config.General.rectMargin * 2 - implicitHeight: Config.Bar.height - Config.General.rectMargin + implicitWidth: layout.implicitWidth + General.rectMargin * 2 + implicitHeight: Bar.height - General.rectMargin - color: Config.Colors.alt - radius: Config.Style.rounding.large + color: Colors.alt + radius: Style.rounding.large RowLayout { id: layout anchors.centerIn: parent - spacing: Config.Bar.resourceIconTextSpacing + spacing: Bar.resourceIconTextSpacing Item { Layout.fillWidth: true } - Icons { + Icon { text: root.icon } IText { -- cgit v1.2.3