Interface IWorkspace
Represents a window-based workspace. A workspace directly contains top-level windows, each of which could belong to a virtual desktops. The workspace can span across multiple monitors.
Inherited Members
Namespace: WinMan
Assembly: WinMan.dll
Syntax
public interface IWorkspace : IDisposable
Properties
| Improve this Doc View SourceCursorLocation
Returns the current cursor location.
Declaration
Point CursorLocation { get; }
Property Value
Type | Description |
---|---|
Point |
DisplayManager
The IDisplayManager instance.
Declaration
IDisplayManager DisplayManager { get; }
Property Value
Type | Description |
---|---|
IDisplayManager |
FocusedWindow
A reference to the currently focused window or null, if no top-level visible window is focused.
Declaration
IWindow FocusedWindow { get; }
Property Value
Type | Description |
---|---|
IWindow |
IsOpen
Has Open() been called.
Declaration
bool IsOpen { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
VirtualDesktopManager
The IVirtualDesktopManager instance.
Declaration
IVirtualDesktopManager VirtualDesktopManager { get; }
Property Value
Type | Description |
---|---|
IVirtualDesktopManager |
WatchInterval
Some workspace implementations might require dirty checking to detect changes. The higher this value is, the less system resources will be used.
A value of System.TimeSpan.MaxValue disables automatic dirty checking.
Alternatively, you may also call RefreshConfiguration(), to run a change-detection cycle manually.
Declaration
TimeSpan WatchInterval { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
Methods
| Improve this Doc View SourceCreateSnapshotZOrderComparer()
Creates a comparer that uses a snapshot of the current workspace to compare windows.
Declaration
IComparer<IWindow> CreateSnapshotZOrderComparer()
Returns
Type | Description |
---|---|
System.Collections.Generic.IComparer<IWindow> |
FindWindow(IntPtr)
Finds a window by its native window handle. This will be a window that has already been identified by the application, but might not necessarily be a top-level application window.
Declaration
IWindow FindWindow(IntPtr windowHandle)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | windowHandle |
Returns
Type | Description |
---|---|
IWindow |
GetSnapshot()
Returns a snapshot of the windows in the current workspace.
Declaration
IReadOnlyList<IWindow> GetSnapshot()
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<IWindow> |
Open()
Attaches system hooks and creates required data structures. WindowManaging events will be emitted for windows currently present in the workspace before this call returns.
Declaration
void Open()
RefreshConfiguration()
Manually instructs the underlying implementation to run an change-detection cycle on the workspace.
Declaration
void RefreshConfiguration()
UnsafeCreateFromHandle(IntPtr)
Creates an IWindow instance for the corresponding handle. This instance may not compare equal to other IWindow references to the same OS window. Use this only for throaway instances where you need to read a certain property of the window. Events will not be raised on this instance, as it is not tied to the workspace backend.
The window is not required to be a top-level or application window. This method is an escape hatch.
Declaration
IWindow UnsafeCreateFromHandle(IntPtr windowHandle)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | windowHandle |
Returns
Type | Description |
---|---|
IWindow |
Events
| Improve this Doc View SourceCursorLocationChanged
The location of the cursor has changed. This event fires freqently and might now be ideal for doing heavy calculations.
Declaration
event EventHandler<CursorLocationChangedEventArgs> CursorLocationChanged
Event Type
Type | Description |
---|---|
System.EventHandler<CursorLocationChangedEventArgs> |
FocusedWindowChanged
The currently focused window has changed.
Declaration
event EventHandler<FocusedWindowChangedEventArgs> FocusedWindowChanged
Event Type
Type | Description |
---|---|
System.EventHandler<FocusedWindowChangedEventArgs> |
UnhandledException
An exception raised during event handling or in the OS-specific workspace implementation was thrown and uncaught.
Declaration
event UnhandledExceptionEventHandler UnhandledException
Event Type
Type | Description |
---|---|
System.UnhandledExceptionEventHandler |
WindowAdded
The window was just added to the workspace.
Declaration
event EventHandler<WindowChangedEventArgs> WindowAdded
Event Type
Type | Description |
---|---|
System.EventHandler<WindowChangedEventArgs> |
WindowManaging
The window was initially present when Open() was first called. WindowManaging + WindowAdded used together is better that looping on the current window list first, then attaching to WindowAdded, as it takes care of concurrency issues.
Declaration
event EventHandler<WindowChangedEventArgs> WindowManaging
Event Type
Type | Description |
---|---|
System.EventHandler<WindowChangedEventArgs> |
WindowRemoved
The window was just removed to the workspace. The window object will be practically useless, but you can use this event for cleanup.
Declaration
event EventHandler<WindowChangedEventArgs> WindowRemoved
Event Type
Type | Description |
---|---|
System.EventHandler<WindowChangedEventArgs> |