Description
On Linux systems, the openWindows() function returns undefined when it fails to retrieve information for any single window, even if other windows are accessible. This causes a complete loss of window tracking functionality.
Current Behavior
When openWindows() encounters a window it cannot access (zombie window, permission issues, etc.), the entire function returns undefined, losing all window information.
Expected Behavior
The function should skip inaccessible windows and return information for all windows it can successfully access, similar to how the Windows implementation works.
Steps to Reproduce
- Use
get-windows on a Linux system with X11
- Have a process that creates a window and then terminates abnormally (leaving a zombie window ID in X11)
- Call
openWindows()
- The function returns
undefined instead of a list of accessible windows
System Information
- OS: Linux (Ubuntu 22.04)
- Window System: X11
- get-windows version: 9.2.0
- Node.js version: 18+
Root Cause
The issue is in lib/linux.js at line 162:
for await (const windowId of windowsIds) {
openWindows.push(await getWindowInformation(Number.parseInt(windowId, 16)));
}
When getWindowInformation() throws an error for any window, the entire openWindows() function fails.
Impact
- Users lose all window tracking capability when even one window is inaccessible
- The issue persists until system restart (zombie windows remain in X11)
- Affects any application using
get-windows for window management on Linux
Proposed Solution
Add try-catch blocks around individual window information retrieval (see PR #198).
Related
Description
On Linux systems, the
openWindows()function returnsundefinedwhen it fails to retrieve information for any single window, even if other windows are accessible. This causes a complete loss of window tracking functionality.Current Behavior
When
openWindows()encounters a window it cannot access (zombie window, permission issues, etc.), the entire function returnsundefined, losing all window information.Expected Behavior
The function should skip inaccessible windows and return information for all windows it can successfully access, similar to how the Windows implementation works.
Steps to Reproduce
get-windowson a Linux system with X11openWindows()undefinedinstead of a list of accessible windowsSystem Information
Root Cause
The issue is in
lib/linux.jsat line 162:When
getWindowInformation()throws an error for any window, the entireopenWindows()function fails.Impact
get-windowsfor window management on LinuxProposed Solution
Add try-catch blocks around individual window information retrieval (see PR #198).
Related