Resolve taskbar icons via Wayland appId instead of Hyprland's IPC class

Taskbar icons only resolved for windows already open when Quickshell
started - anything opened afterward fell back to the letter placeholder.
lastIpcObject (Hyprland's IPC JSON snapshot) apparently lags or stays
stale for windows opened after Quickshell is already running.

Switched to preferring the Wayland toplevel handle's appId, which the
compositor sets immediately on window creation, with lastIpcObject.class
kept as a fallback. Fixes the common case (opening a window after
Quickshell is running); pre-existing windows at Quickshell startup can
still miss their icon due to a startup enumeration race between
Quickshell and the Wayland toplevel-management protocol - acceptable
since that's not really a real-world scenario.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94
This commit is contained in:
nico
2026-09-10 17:46:56 +02:00
parent a56826e553
commit ad6c8dfda5

View File

@@ -405,7 +405,15 @@ Variants {
id: taskBtn
required property var modelData
readonly property bool isActive: bar.activeToplevel !== null && taskBtn.modelData.address === bar.activeToplevel.address
readonly property string wmClass: taskBtn.modelData.lastIpcObject ? (taskBtn.modelData.lastIpcObject.class || "") : ""
// Prefer the Wayland toplevel handle's appId - it's set by the
// compositor immediately on window creation. lastIpcObject
// (Hyprland's IPC JSON snapshot) can lag or stay stale for
// windows opened after Quickshell started, which was leaving
// icons unresolved for anything not already open at launch.
readonly property string wmClass: {
if (taskBtn.modelData.wayland && taskBtn.modelData.wayland.appId) return taskBtn.modelData.wayland.appId
return taskBtn.modelData.lastIpcObject ? (taskBtn.modelData.lastIpcObject.class || "") : ""
}
readonly property var desktopEntry: {
// heuristicLookup() is a plain call, not a reactive property read;
// depend on applications explicitly so this re-evaluates once the