Package oshi.software.os
Class OSDesktopWindow
java.lang.Object
oshi.software.os.OSDesktopWindow
This class encapsulates information about a window on the operating system's GUI desktop
-
Constructor Summary
ConstructorDescriptionOSDesktopWindow
(long windowId, String title, String command, Rectangle locAndSize, long owningProcessId, int order, boolean visible) -
Method Summary
Modifier and TypeMethodDescriptionGets the command name (possibly the full file path) of the window's executable program, if known.Gets aRectangle
representing the window's location and size.int
getOrder()
Makes a best effort to get the order in which this window appears on the desktop.long
Gets the process ID of the process which owns this window, if known.getTitle()
Gets the Window title, if any.long
Gets the operating system's handle, window ID, or other unique identifier for this window.boolean
Makes a best effort to report whether the window is visible to the user.toString()
-
Constructor Details
-
OSDesktopWindow
-
-
Method Details
-
getWindowId
public long getWindowId()Gets the operating system's handle, window ID, or other unique identifier for this window.On Winodws, this can be converted to a
WinDef.HWND
usingnew HWND(new Pointer(windowId))
. On macOS, this is the Core Graphics Window ID. On Unix-like systems, this is the X11 Window ID.- Returns:
- the windowId
-
getTitle
Gets the Window title, if any.- Returns:
- the title, which may be an empty string if the window has no title.
-
getCommand
Gets the command name (possibly the full file path) of the window's executable program, if known.- Returns:
- the command
-
getLocAndSize
Gets aRectangle
representing the window's location and size.- Returns:
- the location and size
-
getOwningProcessId
public long getOwningProcessId()Gets the process ID of the process which owns this window, if known.- Returns:
- the owningProcessId
-
getOrder
public int getOrder()Makes a best effort to get the order in which this window appears on the desktop. Higher values are more in the foreground.On Windows, this represents the Z Order of the window, and is not guaranteed to be atomic, as it could be impacted by race conditions.
On macOS this is the window layer. Note that multiple windows may share the same layer.
On X11 this represents the stacking order of the windows.
- Returns:
- a best effort identification of the window's Z order relative to other windows
-
isVisible
public boolean isVisible()Makes a best effort to report whether the window is visible to the user. A "visible" window may be completely transparent.- Returns:
true
if the window is visible to users or if visibility can not be determined,false
otherwise.
-
toString
-