updated pi, quickshell, and ollama
This commit is contained in:
@@ -47,6 +47,20 @@ QtObject {
|
||||
property bool batteryCharging: false
|
||||
property string batteryStatus: "Full"
|
||||
|
||||
// GPU VRAM Monitoring (NVIDIA)
|
||||
property string gpuVramUsed: "0"
|
||||
property string gpuVramTotal: "0"
|
||||
property int gpuVramPercent: 0
|
||||
|
||||
// System HUD state (replaces individual popup states)
|
||||
property bool systemHudVisible: false
|
||||
property string systemHudActiveSection: "" // "volume", "wifi", "calendar", etc.
|
||||
|
||||
// Workspace tracking
|
||||
property int activeWorkspace: 1
|
||||
property var workspaceList: [1, 2, 3, 4, 5]
|
||||
property var workspaceNames: ({1: "main", 2: "browser", 3: "code", 4: "media", 5: "misc"})
|
||||
|
||||
// Media Player State (MPRIS)
|
||||
property string mediaTitle: ""
|
||||
property string mediaArtist: ""
|
||||
@@ -60,6 +74,7 @@ QtObject {
|
||||
wifiPopupVisible = false;
|
||||
batteryPopupVisible = false;
|
||||
calendarPopupVisible = false;
|
||||
systemHudVisible = false;
|
||||
}
|
||||
|
||||
function toggleSpotlight() {
|
||||
@@ -77,12 +92,25 @@ QtObject {
|
||||
aboutMacVisible = !aboutMacVisible;
|
||||
}
|
||||
|
||||
function toggleSystemHud() {
|
||||
closeAllPopups();
|
||||
systemHudVisible = !systemHudVisible;
|
||||
}
|
||||
|
||||
function switchWorkspace(n) {
|
||||
Hyprland.dispatch("workspace " + n);
|
||||
}
|
||||
|
||||
// Hyprland raw event processing
|
||||
readonly property Connections hyprConn: Connections {
|
||||
target: Hyprland
|
||||
function onRawEvent(event) {
|
||||
function onRawEvent(event) { console.log(JSON.stringify(event), event.name, event.event, event.data);
|
||||
if (!event) return;
|
||||
if (event.startsWith("activewindow>>")) {
|
||||
if (event.startsWith("workspace>>")) {
|
||||
const data = event.substring(11);
|
||||
const wsNum = parseInt(data);
|
||||
if (!isNaN(wsNum)) root.activeWorkspace = wsNum;
|
||||
} else if (event.startsWith("activewindow>>")) {
|
||||
const data = event.substring(14);
|
||||
const parts = data.split(",");
|
||||
const title = parts[1] ? parts[1].trim() : (parts[0] ? parts[0].trim() : "");
|
||||
@@ -127,6 +155,7 @@ QtObject {
|
||||
audioProc.running = true;
|
||||
brightProc.running = true;
|
||||
mprisProc.running = true;
|
||||
gpuProc.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +164,7 @@ QtObject {
|
||||
command: ["bash", "-c", "read -r c u n s i io ir st g gn < /proc/stat; t1=$((u+n+s+i+io+ir+st+g+gn)); i1=$((i+io)); sleep 0.15; read -r c u n s i io ir st g gn < /proc/stat; t2=$((u+n+s+i+io+ir+st+g+gn)); i2=$((i+io)); td=$((t2-t1)); id=$((i2-i1)); [ $td -gt 0 ] && echo $(( (td-id)*100/td )) || echo 0"]
|
||||
stdout: StdioCollector {
|
||||
onDataChanged: {
|
||||
const val = parseInt(data.trim());
|
||||
const val = parseInt(String(data).trim());
|
||||
if (!isNaN(val)) root.cpuPercent = Math.max(0, Math.min(100, val));
|
||||
}
|
||||
}
|
||||
@@ -145,7 +174,7 @@ QtObject {
|
||||
command: ["bash", "-c", "t=$(grep MemTotal /proc/meminfo | awk '{print $2}'); a=$(grep MemAvailable /proc/meminfo | awk '{print $2}'); if [ -n \"$t\" ] && [ -n \"$a\" ] && [ \"$t\" -gt 0 ]; then u=$((t-a)); p=$((u*100/t)); ug=$(awk \"BEGIN {printf \\\"%.1f\\\", $u/1048576}\"); tg=$(awk \"BEGIN {printf \\\"%.1f\\\", $t/1048576}\"); echo \"$p $ug $tg\"; fi"]
|
||||
stdout: StdioCollector {
|
||||
onDataChanged: {
|
||||
const parts = data.trim().split(" ");
|
||||
const parts = String(data).trim().split(" ");
|
||||
if (parts.length >= 3) {
|
||||
root.memPercent = parseInt(parts[0]) || 0;
|
||||
root.memUsedGb = parts[1];
|
||||
@@ -159,7 +188,7 @@ QtObject {
|
||||
command: ["bash", "-c", "b=$(find /sys/class/power_supply/ -name 'BAT*' 2>/dev/null | head -n 1); if [ -n \"$b\" ]; then cap=$(cat $b/capacity 2>/dev/null || echo 100); st=$(cat $b/status 2>/dev/null || echo Full); echo \"1 $cap $st\"; else echo \"0 100 AC\"; fi"]
|
||||
stdout: StdioCollector {
|
||||
onDataChanged: {
|
||||
const parts = data.trim().split(" ");
|
||||
const parts = String(data).trim().split(" ");
|
||||
if (parts.length >= 3) {
|
||||
root.batteryPresent = parts[0] === "1";
|
||||
root.batteryPercent = parseInt(parts[1]) || 100;
|
||||
@@ -174,7 +203,7 @@ QtObject {
|
||||
command: ["bash", "-c", "ssid=\"\"; if command -v nmcli &>/dev/null; then ssid=$(nmcli -t -f active,ssid dev wifi 2>/dev/null | grep '^yes:' | cut -d':' -f2); fi; [ -z \"$ssid\" ] && [ -f /proc/net/wireless ] && ssid=$(iwgetid -r 2>/dev/null); ip=$(ip -4 route get 1.1.1.1 2>/dev/null | awk '{print $7; exit}'); echo \"${ssid:-Ethernet} ${ip:-Offline}\""]
|
||||
stdout: StdioCollector {
|
||||
onDataChanged: {
|
||||
const str = data.trim();
|
||||
const str = String(data).trim();
|
||||
const parts = str.split(" ");
|
||||
if (parts.length >= 2) {
|
||||
root.wifiSsid = parts[0];
|
||||
@@ -189,7 +218,7 @@ QtObject {
|
||||
command: ["bash", "-c", "if command -v pactl &>/dev/null; then v=$(pactl get-sink-volume @DEFAULT_SINK@ 2>/dev/null | grep -Po '[0-9]+(?=%)' | head -n 1); m=$(pactl get-sink-mute @DEFAULT_SINK@ 2>/dev/null | grep -q yes && echo 1 || echo 0); echo \"${v:-50} $m\"; fi"]
|
||||
stdout: StdioCollector {
|
||||
onDataChanged: {
|
||||
const parts = data.trim().split(" ");
|
||||
const parts = String(data).trim().split(" ");
|
||||
if (parts.length >= 2) {
|
||||
root.volume = parseInt(parts[0]) || 50;
|
||||
root.volumeMuted = parts[1] === "1";
|
||||
@@ -202,7 +231,7 @@ QtObject {
|
||||
command: ["bash", "-c", "if command -v brightnessctl &>/dev/null; then b=$(brightnessctl -m 2>/dev/null | cut -d, -f4 | tr -d '%'); echo \"${b:-100}\"; else echo 100; fi"]
|
||||
stdout: StdioCollector {
|
||||
onDataChanged: {
|
||||
const val = parseInt(data.trim());
|
||||
const val = parseInt(String(data).trim());
|
||||
if (!isNaN(val)) root.brightness = val;
|
||||
}
|
||||
}
|
||||
@@ -212,7 +241,7 @@ QtObject {
|
||||
command: ["bash", "-c", "if command -v playerctl &>/dev/null; then t=$(playerctl metadata title 2>/dev/null); a=$(playerctl metadata artist 2>/dev/null); s=$(playerctl status 2>/dev/null); echo \"$s|$t|$a\"; fi"]
|
||||
stdout: StdioCollector {
|
||||
onDataChanged: {
|
||||
const parts = data.trim().split("|");
|
||||
const parts = String(data).trim().split("|");
|
||||
if (parts.length >= 3) {
|
||||
root.mediaPlaying = parts[0] === "Playing";
|
||||
root.mediaTitle = parts[1] || "";
|
||||
@@ -226,12 +255,30 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
readonly property Process gpuProc: Process {
|
||||
command: ["bash", "-c", "nvidia-smi --query-gpu=memory.used,memory.total --format=csv,noheader,nounits 2>/dev/null || echo '0, 0'"]
|
||||
stdout: StdioCollector {
|
||||
onDataChanged: {
|
||||
const parts = String(data).trim().split(",");
|
||||
if (parts.length >= 2) {
|
||||
const usedMiB = parseInt(parts[0].trim());
|
||||
const totalMiB = parseInt(parts[1].trim());
|
||||
if (!isNaN(usedMiB) && !isNaN(totalMiB) && totalMiB > 0) {
|
||||
root.gpuVramUsed = (usedMiB / 1024).toFixed(1);
|
||||
root.gpuVramTotal = (totalMiB / 1024).toFixed(1);
|
||||
root.gpuVramPercent = Math.round((usedMiB / totalMiB) * 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
readonly property Process clientsProc: Process {
|
||||
command: ["bash", "-c", "if command -v hyprctl &>/dev/null; then hyprctl -j clients 2>/dev/null; else echo '[]'; fi"]
|
||||
stdout: StdioCollector {
|
||||
onDataChanged: {
|
||||
try {
|
||||
const parsed = JSON.parse(data.trim());
|
||||
const parsed = JSON.parse(String(data).trim());
|
||||
if (Array.isArray(parsed)) {
|
||||
root.runningApps = parsed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user