diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-07-12 18:15:32 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-07-12 18:15:32 +0800 |
| commit | 299bf0bae8be6ab505f97d6aba4f82e4e6f96f62 (patch) | |
| tree | e1a72a68b5c2fae7fab097a80462233878a3231c /bar | |
| parent | ce5f49a9324bceccab821c1d2ebf3f72bdfc09ea (diff) | |
lot of minor improvement added utils and working networkusage
Diffstat (limited to 'bar')
| -rw-r--r-- | bar/ActiveWindow.qml | 30 | ||||
| -rw-r--r-- | bar/Bar.qml | 24 | ||||
| -rw-r--r-- | bar/Cpu.qml | 27 | ||||
| -rw-r--r-- | bar/Gpu.qml | 27 | ||||
| -rw-r--r-- | bar/Memory.qml | 27 | ||||
| -rw-r--r-- | bar/Mpris.qml | 4 | ||||
| -rw-r--r-- | bar/Network.qml | 34 | ||||
| -rw-r--r-- | bar/Temp.qml | 27 |
8 files changed, 184 insertions, 16 deletions
diff --git a/bar/ActiveWindow.qml b/bar/ActiveWindow.qml index efdbfd9..4cb1a08 100644 --- a/bar/ActiveWindow.qml +++ b/bar/ActiveWindow.qml @@ -1,23 +1,35 @@ import QtQuick +import QtQuick.Layouts import Quickshell import Quickshell.Wayland import Quickshell.Widgets import qs.utils +import qs.config Item { id: root property var toplevel: ToplevelManager.activeToplevel property var icon: Quickshell.iconPath(AppSearch.guessIcon(toplevel?.appId), "image-missing") + anchors.verticalCenter: parent.verticalCenter - IconImage { - source: root.icon - implicitWidth: 32 - implicitHeight: 32 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 8 + Rectangle { + anchors.fill: parent + color: "blue" } - Text { - text: root.toplevel?.title + RowLayout { + anchors.fill: parent + + anchors.verticalCenter: parent.verticalCenter + IconImage { + source: root.icon + implicitWidth: Bar.appIconSize + implicitHeight: Bar.appIconSize + Layout.fillHeight: true + Layout.fillWidth: false + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + } + Text { + text: root.toplevel?.title + } } } diff --git a/bar/Bar.qml b/bar/Bar.qml index f8d3a2d..24fc0ce 100644 --- a/bar/Bar.qml +++ b/bar/Bar.qml @@ -65,7 +65,7 @@ Scope { Layout.preferredWidth: 1 } } - RowLayout { + Item { id: centerRow Layout.fillWidth: true Layout.fillHeight: true @@ -76,11 +76,25 @@ Scope { id: rightRow Layout.fillWidth: true Layout.preferredWidth: 1 - Rectangle { + Cpu { + Layout.fillHeight: true + Layout.fillWidth: true + } + Memory { + Layout.fillHeight: true + Layout.fillWidth: true + } + Gpu { + Layout.fillHeight: true + Layout.fillWidth: true + } + Temp { + Layout.fillHeight: true + Layout.fillWidth: true + } + Network { + Layout.fillHeight: true Layout.fillWidth: true - Text { - text: "a" - } } } } diff --git a/bar/Cpu.qml b/bar/Cpu.qml new file mode 100644 index 0000000..5d65415 --- /dev/null +++ b/bar/Cpu.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.cpu + } + Text { + text: Math.round(Services.Resource.cpuUsage * 100) + } + Item { + Layout.fillWidth: true + } + } +} diff --git a/bar/Gpu.qml b/bar/Gpu.qml new file mode 100644 index 0000000..e47d8f8 --- /dev/null +++ b/bar/Gpu.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.gpu + } + Text { + text: Services.Resource.gpuUsage + } + Item { + Layout.fillWidth: true + } + } +} diff --git a/bar/Memory.qml b/bar/Memory.qml new file mode 100644 index 0000000..130c9ea --- /dev/null +++ b/bar/Memory.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.memory + } + Text { + text: Math.round(Services.Resource.memoryUsedPercentage * 100) + "%" + } + Item { + Layout.fillWidth: true + } + } +} diff --git a/bar/Mpris.qml b/bar/Mpris.qml index 87bef93..8d56335 100644 --- a/bar/Mpris.qml +++ b/bar/Mpris.qml @@ -2,7 +2,7 @@ import QtQuick.Layouts import QtQuick import Quickshell import Quickshell.Services.Mpris -import qs.services +import qs.services as Services import qs.config // import Quickshell.Utils @@ -10,7 +10,7 @@ import qs.config Item { id: root height: Bar.height - readonly property MprisPlayer activePlayer: SMpris.activePlayer + readonly property MprisPlayer activePlayer: Services.Mpris.activePlayer readonly property string cleanedTitle: cleanMusicTitle(activePlayer?.trackTitle) || qsTr("No media") // length broken (https://github.com/quickshell-mirror/quickshell/issues/109) readonly property string position: friendlyTimeForSeconds(activePlayer?.position) || "0:00" diff --git a/bar/Network.qml b/bar/Network.qml new file mode 100644 index 0000000..df70ecd --- /dev/null +++ b/bar/Network.qml @@ -0,0 +1,34 @@ +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: Services.Network.state + } + Text { + text: Math.round(Services.Resource.cpuUsage * 100) + } + Text { + text: NetworkUsage.up + " " + NetworkUsage.upUnit + } + Text { + text: NetworkUsage.down + " " + NetworkUsage.downUnit + } + Item { + Layout.fillWidth: true + } + } +} diff --git a/bar/Temp.qml b/bar/Temp.qml new file mode 100644 index 0000000..c2c5f1d --- /dev/null +++ b/bar/Temp.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.temp + } + Text { + text: Math.round(Services.Resource.cpuTemp * 100) + } + Item { + Layout.fillWidth: true + } + } +} |
