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.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();
}
}
}
}
}