using initialTitle instead of currentTitle
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
property string activeWindow: Hyprland.activeToplevel?.title || ""
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Executable
+17
@@ -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"
|
||||
Reference in New Issue
Block a user