diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-07-12 23:21:58 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-07-12 23:21:58 +0800 |
| commit | 1c259d7878c00592916dc6acdb6e22771b22bbf1 (patch) | |
| tree | e78c1513b184a0863e54e83f7365b110ea0301e8 /utils | |
| parent | f2056f05b4649d49f9322d5fcea011a51bda2dfe (diff) | |
finish organize
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/Icons.qml | 34 | ||||
| -rw-r--r-- | utils/NetworkUsage.qml | 68 |
2 files changed, 0 insertions, 102 deletions
diff --git a/utils/Icons.qml b/utils/Icons.qml deleted file mode 100644 index 4b3915c..0000000 --- a/utils/Icons.qml +++ /dev/null @@ -1,34 +0,0 @@ -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/utils/NetworkUsage.qml b/utils/NetworkUsage.qml deleted file mode 100644 index a5e584f..0000000 --- a/utils/NetworkUsage.qml +++ /dev/null @@ -1,68 +0,0 @@ -pragma Singleton -// pragma ComponentBehavior: Bound - -import Quickshell -import Quickshell.Io -import QtQuick -import "networkUsage.js" as Network -import qs.config - -Singleton { - property int up: 0 - property string upUnit: "" - property int down: 0 - property string downUnit: "" - - property string __iface: "" - property var __prev: ({ - rx: 0, - tx: 0 - }) - - Timer { - interval: General.resourceUpdateInterval * 1000 - running: true - repeat: true - onTriggered: update() - } - - function update() { - __iface = Network.defaultInterface(getRouteProcess.stdout.text); - const cur = Network.getRxTxBytes(getNetDevProcess.stdout.text, __iface); - const sec = General.resourceUpdateInterval; - const rawUp = (cur.tx - __prev.tx) / sec; - const rawDown = (cur.rx - __prev.rx) / sec; - - up = Network.formatSize(rawUp, false); - upUnit = Network.formatSize(rawUp, true); - down = Network.formatSize(rawDown, false); - downUnit = Network.formatSize(rawDown, true); - - __prev = cur; - getRouteProcess.running = true; - getNetDevProcess.running = true; - } - - Process { - id: getRouteProcess - running: true - command: ["ip", "route"] - stdout: StdioCollector {} - } - - Process { - id: getNetDevProcess - running: true - command: ["cat", "/proc/net/dev"] - stdout: StdioCollector {} - } - - Component.onCompleted: { - getRouteProcess.running = true; - getNetDevProcess.running = true; - if (getRouteProcess.stdout.text) - __iface = Network.defaultInterface(getRouteProcess.stdout.text); - if (getNetDevProcess.stdout.text) - __prev = Network.getRxTxBytes(getNetDevProcess.stdout.text, __iface); - } -} |
