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,9 @@
import Quickshell
pragma Singleton
Singleton {
property var bgBar: Qt.rgba(0, 0, 0, 0.21)
property var bgBlur: Qt.rgba(0, 0, 0, 0.3)
property var fg: "white"
property list<var> monitorColors: ["#e06c75", "#e5c07b", "#98c379", "#61afef"]
}

View File

@@ -0,0 +1,67 @@
pragma Singleton
import Quickshell
import Quickshell.Hyprland
import QtQuick
Singleton {
id: hyprland
property list<HyprlandWorkspace> workspaces: sortWorkspaces(Hyprland.workspaces.values)
property HyprlandWorkspace focusedWorkspace: Hyprland.focusedMonitor?.activeWorkspace
property int maxWorkspace: findMaxId()
function sortWorkspaces(ws) {
return [...ws].sort((a, b) => a?.id - b?.id);
}
function switchWorkspace(w: int): void {
console.log(`workspace: focus ${focusedWorkspace.id} -> ${w}`);
Hyprland.dispatch(`workspace ${w}`);
}
function findMaxId(): int {
let num = hyprland.workspaces.length;
return hyprland.workspaces[num - 1]?.id;
}
Connections {
target: Hyprland
function onRawEvent(event) {
// console.log("EVENT NAME", event.name);
// consow.wg("EVENT DATA", event.data);
let eventName = event.name;
switch (eventName) {
// Both of these are required in order to detect workspace changes
// even when switching monitors.
// case "workspacev2":
// {
// // hyprland.focusedWorkspace = Hyprland.focusedMonitor?.activeWorkspace;
// console.log(`workspace: ${hyprland.focusedWorkspace.id}`);
// console.log(`num workspaces ${hyprland.workspaces.length}`)
// console.log(`num workspaces (real) ${Hyprland.workspaces.values.length}`)
// break;
// }
// case "focusedmonv2":
// {
// // hyprland.focusedWorkspace = Hyprland.focusedMonitor?.activeWorkspace;
// console.log(`workspace: ${hyprland.focusedWorkspace.id}`);
// console.log(`num workspaces ${hyprland.workspaces.length}`)
// console.log(`num workspaces (real) ${Hyprland.workspaces.values.length}`)
// break;
// }
case "createworkspacev2":
{
hyprland.workspaces = hyprland.sortWorkspaces(Hyprland.workspaces.values);
hyprland.maxWorkspace = findMaxId();
}
case "destroyworkspacev2":
{
hyprland.workspaces = hyprland.sortWorkspaces(Hyprland.workspaces.values);
hyprland.maxWorkspace = findMaxId();
}
}
}
}
}

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
}
}
}

View File

@@ -0,0 +1,29 @@
pragma Singleton
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
property var locale: Qt.locale()
function createDate(): string {
let date = new Date();
let hh = date.getHours().toString().padStart(2, 0);
let mm = date.getMinutes().toString().padStart(2, 0)
let weekday = locale.dayName(date.getDay(), Locale.ShortFormat)
let month = locale.monthName(date.getMonth(), Locale.ShortFormat)
let day = date.getDate()
return `${weekday} ${month} ${day} ${hh}:${mm}`
}
property var time: createDate()
Timer {
interval: 1000
running: true
repeat: true
onTriggered: time = createDate()
}
}