Grouped Window List Window Association Enhancements#13828
Open
Twilight0 wants to merge 2 commits into
Open
Conversation
…licate panel icons When Cinnamon's WindowTracker fails to associate a running window with a `.desktop` launcher (due to missing `StartupWMClass` declarations, case mismatches, or process wrappers common in Electron/wrapper apps), the Grouped Window List (GWL) applet creates a new transient launcher on the panel instead of nesting the app under the existing pinned launcher. This change enhances `getAppFromWindow` by proactively checking the user's pinned favorites array first. It checks for a match between the window's WM_CLASS (both class and instance name) or GTK application ID, and the pinned application properties: 1. Pinned launcher desktop file base name (case-insensitive) 2. Desktop file's `StartupWMClass` key 3. Pinned application command line/executable binary Additionally, this fixes a potential early-startup TypeError crash (`TypeError: currentWorkspace is null`) in `onWindowSkipTaskbarChanged` by inserting a null-check check at the entry point.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In Cinnamon, the Grouped Window List (GWL) applet relies on
Cinnamon.WindowTrackerto associate running windows with their corresponding launcher.desktopfiles. This association frequently fails for applications that:StartupWMClasskey in their.desktopfiles.WM_CLASSvalues and their.desktopfile names (e.g.Brave-browservsbrave-browser.desktoporGitKrakenvsGitKraken.desktop).When this failure occurs, the window is classified as a transient or generic application. The GWL applet then spawns a duplicate, unpinned icon on the panel rather than nesting/grouping the window under its existing pinned launcher.
Additionally, a potential early-startup race condition existed in
onWindowSkipTaskbarChangedwheregetCurrentWorkspace()could returnnullbefore workspaces were fully loaded, causing a fatal JS TypeError (TypeError: currentWorkspace is null) that broke subsequent applet event handling.Changes Included
1. Pinned Launcher Fallback Matching (
_matchWindowToPinnedApp)Introduced a helper method
_matchWindowToPinnedApp(metaWindow)that proactively queries the pinned favorites list to resolve window associations if the standardWindowTrackerlookup fails or returns a transient app. It matches a window'sWM_CLASS(both class name and instance name) and GTK application ID against:gitkrakenderived fromGitKraken.desktop).StartupWMClasskey from the.desktopfile metadata (usingGio.AppInfoAPIs) and compares it case-insensitively..desktopentry'sExecfield to match against the running process's window class.2. TypeError Null-Check
Added a null-check check for
currentWorkspaceat the entry point ofonWindowSkipTaskbarChangedinapplet.js:This safely prevents early-startup crashes when taskbar skip events are fired before the workspace array is fully initialized.
Rationale & Benefits
.desktopentries to addStartupWMClasskeys or fix casing to prevent duplicate icons.