remove qs, fixes to waybar

This commit is contained in:
2025-06-30 17:19:24 +02:00
parent 4b71da350f
commit ce5379ffc7
165 changed files with 16249 additions and 374 deletions

View File

@@ -0,0 +1,67 @@
pragma Singleton
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
property int cpu_percent
property string cpu_freq
property int mem_percent
property string mem_used
Process {
id: process_cpu_percent
running: true
command: ["sh", "-c", "top -bn1 | rg '%Cpu' | awk '{print 100-$8}'"]
stdout: SplitParser {
onRead: data => cpu_percent = Math.round(data)
}
}
Process {
id: process_cpu_freq
running: true
command: ["sh", "-c", "lscpu --parse=MHZ"]
stdout: SplitParser {
onRead: data => {
// delete the first 4 lines (comments)
const mhz = data.split("\n").slice(4);
// compute mean frequency
const freq = mhz.reduce((acc, e) => acc + Number(e), 0) / mhz.length;
cpu_freq = Math.round(freq) + " MHz";
}
}
}
Process {
id: process_mem_percent
running: true
command: ["sh", "-c", "free | awk 'NR==2{print $3/$2*100}'"]
stdout: SplitParser {
onRead: data => mem_percent = Math.round(data)
}
}
Process {
id: process_mem_used
running: true
command: ["sh", "-c", "free --si -h | awk 'NR==2{print $3}'"]
stdout: SplitParser {
onRead: data => mem_used = data
}
}
Timer {
interval: 2000
running: true
repeat: true
onTriggered: () => {
process_cpu_percent.running = true
process_cpu_freq.running = true
process_mem_percent.running = true
process_mem_used.running = true
}
}
}