summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-07-12 23:21:58 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-07-12 23:21:58 +0800
commit1c259d7878c00592916dc6acdb6e22771b22bbf1 (patch)
treee78c1513b184a0863e54e83f7365b110ea0301e8
parentf2056f05b4649d49f9322d5fcea011a51bda2dfe (diff)
finish organize
-rw-r--r--bar/Cpu.qml23
-rw-r--r--bar/Gpu.qml22
-rw-r--r--bar/Memory.qml21
-rw-r--r--bar/Network.qml6
-rw-r--r--bar/Power.qml27
-rw-r--r--bar/Temp.qml21
-rw-r--r--bar/TimeDate.qml2
-rw-r--r--components/Icons.qml (renamed from utils/Icons.qml)0
-rw-r--r--components/SimpleResource.qml26
-rw-r--r--services/NetworkUsage.qml (renamed from utils/NetworkUsage.qml)2
10 files changed, 75 insertions, 75 deletions
diff --git a/bar/Cpu.qml b/bar/Cpu.qml
index 5d65415..00cf53c 100644
--- a/bar/Cpu.qml
+++ b/bar/Cpu.qml
@@ -1,27 +1,14 @@
import QtQuick
import QtQuick.Layouts
+import qs.components
+import qs.config
import qs.services as Services
-import qs.utils
-import qs.config as Config
Item {
id: root
- RowLayout {
- Item {
- Layout.fillWidth: true
- }
- anchors.fill: parent
- spacing: Config.Bar.resourceIconTextSpacing
-
- Icons {
- text: Config.Icons.resource.cpu
- }
- Text {
- text: Math.round(Services.Resource.cpuUsage * 100)
- }
- Item {
- Layout.fillWidth: true
- }
+ SimpleResource {
+ text: Math.round(Services.Resource.cpuUsage * 100)
+ icon: Icons.resource.cpu
}
}
diff --git a/bar/Gpu.qml b/bar/Gpu.qml
index e47d8f8..a0e1dd6 100644
--- a/bar/Gpu.qml
+++ b/bar/Gpu.qml
@@ -2,26 +2,12 @@ import QtQuick
import QtQuick.Layouts
import qs.services as Services
-import qs.utils
+import qs.components
import qs.config as Config
Item {
- id: root
- RowLayout {
- Item {
- Layout.fillWidth: true
- }
- anchors.fill: parent
- spacing: Config.Bar.resourceIconTextSpacing
-
- Icons {
- text: Config.Icons.resource.gpu
- }
- Text {
- text: Services.Resource.gpuUsage
- }
- Item {
- Layout.fillWidth: true
- }
+ SimpleResource {
+ icon: Config.Icons.resource.gpu
+ text: Services.Resource.gpuUsage
}
}
diff --git a/bar/Memory.qml b/bar/Memory.qml
index 130c9ea..30a17e6 100644
--- a/bar/Memory.qml
+++ b/bar/Memory.qml
@@ -2,26 +2,13 @@ import QtQuick
import QtQuick.Layouts
import qs.services as Services
-import qs.utils
+import qs.components
import qs.config as Config
Item {
id: root
- RowLayout {
- Item {
- Layout.fillWidth: true
- }
- anchors.fill: parent
- spacing: Config.Bar.resourceIconTextSpacing
-
- Icons {
- text: Config.Icons.resource.memory
- }
- Text {
- text: Math.round(Services.Resource.memoryUsedPercentage * 100) + "%"
- }
- Item {
- Layout.fillWidth: true
- }
+ SimpleResource {
+ icon: Config.Icons.resource.memory
+ text: Math.round(Services.Resource.memoryUsedPercentage * 100) + "%"
}
}
diff --git a/bar/Network.qml b/bar/Network.qml
index df70ecd..3559df0 100644
--- a/bar/Network.qml
+++ b/bar/Network.qml
@@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Layouts
import qs.services as Services
-import qs.utils
+import qs.components
import qs.config as Config
Item {
@@ -22,10 +22,10 @@ Item {
text: Math.round(Services.Resource.cpuUsage * 100)
}
Text {
- text: NetworkUsage.up + " " + NetworkUsage.upUnit
+ text: Services.NetworkUsage.up + " " + Services.NetworkUsage.upUnit
}
Text {
- text: NetworkUsage.down + " " + NetworkUsage.downUnit
+ text: Services.NetworkUsage.down + " " + Services.NetworkUsage.downUnit
}
Item {
Layout.fillWidth: true
diff --git a/bar/Power.qml b/bar/Power.qml
new file mode 100644
index 0000000..93da141
--- /dev/null
+++ b/bar/Power.qml
@@ -0,0 +1,27 @@
+import QtQuick
+import QtQuick.Layouts
+
+import qs.services as Services
+import qs.utils
+import qs.config as Config
+
+Item {
+ id: root
+ RowLayout {
+ Item {
+ Layout.fillWidth: true
+ }
+ anchors.fill: parent
+ spacing: Config.Bar.resourceIconTextSpacing
+
+ Icons {
+ text: Config.Icons.resource.clock
+ }
+ Text {
+ text: Services.TimeDate.time
+ }
+ Item {
+ Layout.fillWidth: true
+ }
+ }
+}
diff --git a/bar/Temp.qml b/bar/Temp.qml
index c2c5f1d..fb84e5a 100644
--- a/bar/Temp.qml
+++ b/bar/Temp.qml
@@ -2,26 +2,13 @@ import QtQuick
import QtQuick.Layouts
import qs.services as Services
-import qs.utils
+import qs.components
import qs.config as Config
Item {
id: root
- RowLayout {
- Item {
- Layout.fillWidth: true
- }
- anchors.fill: parent
- spacing: Config.Bar.resourceIconTextSpacing
-
- Icons {
- text: Config.Icons.resource.temp
- }
- Text {
- text: Math.round(Services.Resource.cpuTemp * 100)
- }
- Item {
- Layout.fillWidth: true
- }
+ SimpleResource {
+ icon: Config.Icons.resource.temp
+ text: Math.round(Services.Resource.cpuTemp * 100)
}
}
diff --git a/bar/TimeDate.qml b/bar/TimeDate.qml
index 93da141..807566a 100644
--- a/bar/TimeDate.qml
+++ b/bar/TimeDate.qml
@@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Layouts
import qs.services as Services
-import qs.utils
+import qs.components
import qs.config as Config
Item {
diff --git a/utils/Icons.qml b/components/Icons.qml
index 4b3915c..4b3915c 100644
--- a/utils/Icons.qml
+++ b/components/Icons.qml
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
+ }
+}
diff --git a/utils/NetworkUsage.qml b/services/NetworkUsage.qml
index a5e584f..844a5a5 100644
--- a/utils/NetworkUsage.qml
+++ b/services/NetworkUsage.qml
@@ -4,7 +4,7 @@ pragma Singleton
import Quickshell
import Quickshell.Io
import QtQuick
-import "networkUsage.js" as Network
+import "../utils/networkUsage.js" as Network
import qs.config
Singleton {