using initialTitle instead of currentTitle

This commit is contained in:
Zacharias-Brohn
2025-10-14 20:58:34 +02:00
parent 2350b6db28
commit 800f3c53e7
6 changed files with 52 additions and 15 deletions
-9
View File
@@ -1,9 +0,0 @@
pragma Singleton
import Quickshell
import Quickshell.Hyprland
Singleton {
id: root
property string activeWindow: Hyprland.activeToplevel?.title || ""
}
+7
View File
@@ -14,6 +14,13 @@ Item {
implicitHeight: 22
property bool warning: percentage * 100 >= warningThreshold
Behavior on percentage {
NumberAnimation {
duration: 300
easing.type: Easing.InOutQuad
}
}
RowLayout {
id: resourceRowLayout
spacing: 2
+2 -3
View File
@@ -5,9 +5,6 @@ import QtQuick
import Quickshell
import Quickshell.Io
/**
* Simple polled resource usage service with RAM, Swap, and CPU usage.
*/
Singleton {
property double memoryTotal: 1
property double memoryFree: 1
@@ -22,6 +19,7 @@ Singleton {
property double gpuUsage: 0
property double gpuMemUsage: 0
property double totalMem: 0
Timer {
interval: 1
running: true
@@ -70,6 +68,7 @@ Singleton {
stdout: StdioCollector {
onStreamFinished: {
totalMem = Number(this.text.trim())
oneshotMem.running = false
}
}
}
+4 -2
View File
@@ -29,6 +29,7 @@ Item {
Resource {
percentage: ResourceUsage.memoryUsedPercentage
warningThreshold: 95
}
Text {
@@ -41,13 +42,14 @@ Item {
Resource {
percentage: ResourceUsage.cpuUsage
warningThreshold: 80
}
Text {
Layout.alignment: Qt.AlignVCenter
font.family: "Material Symbols Rounded"
font.pixelSize: 18
text: "\ue30d"
font.pixelSize: 16
text: "󰢮"
color: "#ffffff"
}
+22 -1
View File
@@ -1,15 +1,36 @@
import QtQuick
import QtQuick.Layouts
import Quickshell.Io
import Quickshell.Hyprland
Item {
id: root
property string currentTitle
Layout.fillHeight: true
Layout.preferredWidth: Math.max( titleText1.implicitWidth, titleText2.implicitWidth ) + 10
clip: true
property string currentTitle: ActiveWindow.activeWindow
property bool showFirst: true
Process {
id: initialTitleProc
command: ["./scripts/initialTitle.sh"]
running: false
stdout: StdioCollector {
onStreamFinished: {
root.currentTitle = this.text.trim().replace(/\"/g, "")
}
}
}
Component.onCompleted: {
Hyprland.rawEvent.connect(( event ) => {
if (event.name === "activewindow") {
initialTitleProc.running = true
}
})
}
onCurrentTitleChanged: {
if (showFirst) {
titleText2.text = currentTitle
+17
View File
@@ -0,0 +1,17 @@
#!/bin/zsh
raw="$(hyprctl activewindow)"
json="$(echo "$raw" | jq -Rn '
[ inputs
| sub("\r$"; "")
| select(test(":"))
| capture("^(?<key>[^:]+):[ \t]*(?<value>.*)$")
| .key |= ltrim
]
| from_entries
')"
title="$(echo "$json" | jq '.initialTitle')"
echo "$title"