diff --git a/modules/overview/Overview.qml b/modules/overview/Overview.qml index c8c0ce7..2bf6892 100644 --- a/modules/overview/Overview.qml +++ b/modules/overview/Overview.qml @@ -184,7 +184,10 @@ Scope { if (targetId !== null) { const clampedTarget = Math.max(minWorkspaceId, Math.min(maxWorkspaceId, targetId)); - Hyprland.dispatch("workspace " + clampedTarget); + if (HyprlandData.isModern) + Hyprland.dispatch(`hl.dsp.focus({workspace = '${clampedTarget}'})`); + else + Hyprland.dispatch("workspace " + clampedTarget); event.accepted = true; } } @@ -198,7 +201,7 @@ Scope { Loader { id: overviewLoader - active: GlobalStates.overviewOpen && (Config?.options.overview.enable ?? true) + active: Config?.options.overview.enable ?? true sourceComponent: OverviewWidget { panelWindow: root visible: true diff --git a/modules/overview/OverviewWidget.qml b/modules/overview/OverviewWidget.qml index 77f17a2..c1fd5cd 100644 --- a/modules/overview/OverviewWidget.qml +++ b/modules/overview/OverviewWidget.qml @@ -244,7 +244,10 @@ Item { onClicked: { if (root.draggingTargetWorkspace === -1) { GlobalStates.overviewOpen = false; - Hyprland.dispatch(`workspace ${workspaceValue}`); + if (HyprlandData.isModern) + Hyprland.dispatch(`hl.dsp.focus({workspace = '${workspaceValue}'})`); + else + Hyprland.dispatch(`workspace ${workspaceValue}`); } } } @@ -363,7 +366,10 @@ Item { window.Drag.active = false; root.draggingFromWorkspace = -1; if (targetWorkspace !== -1 && targetWorkspace !== windowData?.workspace.id) { - Hyprland.dispatch(`movetoworkspacesilent ${targetWorkspace}, address:${window.windowData?.address}`); + if (HyprlandData.isModern) + Hyprland.dispatch(`hl.dsp.window.move({workspace = '${targetWorkspace}', follow = false, window = 'address:${window.windowData?.address}'})`); + else + Hyprland.dispatch(`movetoworkspacesilent ${targetWorkspace}, address:${window.windowData?.address}`); updateWindowPosition.restart(); } else { window.x = window.initX; @@ -376,10 +382,16 @@ Item { if (event.button === Qt.LeftButton) { GlobalStates.overviewOpen = false; - Hyprland.dispatch(`focuswindow address:${windowData.address}`); + if (HyprlandData.isModern) + Hyprland.dispatch(`hl.dsp.focus({ window = 'address:${windowData.address}' })`); + else + Hyprland.dispatch(`focuswindow address:${windowData.address}`); event.accepted = true; } else if (event.button === Qt.MiddleButton) { - Hyprland.dispatch(`closewindow address:${windowData.address}`); + if (HyprlandData.isModern) + Hyprland.dispatch(`hl.dsp.window.close({window = 'address:${windowData.address}'})`); + else + Hyprland.dispatch(`closewindow address:${windowData.address}`); event.accepted = true; } } diff --git a/modules/overview/OverviewWindow.qml b/modules/overview/OverviewWindow.qml index 805e1b6..52894f5 100644 --- a/modules/overview/OverviewWindow.qml +++ b/modules/overview/OverviewWindow.qml @@ -50,7 +50,10 @@ Item { // Window return true; return (windowData?.monitor ?? -1) === widgetMonitorId; } - property var entry: DesktopEntries.heuristicLookup(windowData?.class) + property var entry: { + DesktopEntries.applications.values; // re-run when the entry index updates + return DesktopEntries.heuristicLookup(windowData?.class); + } property string iconName: { const raw = `${entry?.icon ?? ""}`.trim(); const withoutProviderPrefix = raw.replace(/^image:\/\/icon\//, ""); diff --git a/services/HyprlandData.qml b/services/HyprlandData.qml index 8d1d5a4..6748aa1 100644 --- a/services/HyprlandData.qml +++ b/services/HyprlandData.qml @@ -26,6 +26,25 @@ Singleton { property bool pendingLayersUpdate: false property bool pendingWorkspacesUpdate: false property bool pendingActiveWorkspaceUpdate: false + property int atLeastVersion: 55 + property bool isModern: false + + Process { + // Hyprland 0.55 changed dispatcher syntax; keep both paths available. + id: getVersion + command: ["hyprctl", "version", "-j"] + stdout: StdioCollector { + onStreamFinished: { + try { + const data = JSON.parse(text); + const parts = data.version.split(".").map(Number); + root.isModern = parts[1] >= root.atLeastVersion; + } catch (e) { + console.warn("Failed to parse Hyprland version:", e); + } + } + } + } function updateWindowList() { getClients.running = true; @@ -99,6 +118,7 @@ Singleton { Component.onCompleted: { scheduleUpdates(true, true, true, true, true); flushPendingUpdates(); + getVersion.running = true; } Connections {