Interface IWorkspace
- Namespace
- Whim
- Assembly
- Whim.dll
Workspaces contain windows to be organized by layout engines.
public interface IWorkspace : IDisposable
- Inherited Members
- Extension Methods
Properties
ActiveLayoutEngine
The active layout engine.
[Obsolete("Use the picker PickActiveLayoutEngine instead.")]
ILayoutEngine ActiveLayoutEngine { get; }
Property Value
ActiveLayoutEngineIndex
The index of the layout engine in LayoutEngines which is currently active.
int ActiveLayoutEngineIndex { get; }
Property Value
BackingName
The name of the workspace.
string BackingName { get; }
Property Value
Remarks
Until the legacy Workspace implementation is removed, this is called
BackingName
to avoid confusion with Name.
Once the legacy Workspace implementation is removed, this will be
called Name
.Id
The unique id of the workspace.
Guid Id { get; }
Property Value
LastFocusedWindow
The last focused window. This is still set when the window has lost focus (provided another
window in the workspace does not have focus). This is useful in cases like when the
command palette is opened and wants to perform an action on the last focused window.
To focus the last focused window, use FocusLastFocusedWindow().
[Obsolete("Use the picker PickLastFocusedWindow instead.")]
IWindow? LastFocusedWindow { get; }
Property Value
LastFocusedWindowHandle
The index of the last focused window in the workspace.
WARNING: When the value is 0, it means that no window is focused. Check this with IsNull.
HWND LastFocusedWindowHandle { get; }
Property Value
LayoutEngines
All the layout engines currently in the workspace.
ImmutableList<ILayoutEngine> LayoutEngines { get; }
Property Value
Name
The name of the workspace. When the
Name
is set, the
WorkspaceRenamed event is triggered.[Obsolete("Use the picker PickWorkspaceName or SetWorkspaceNameTransform instead.")]
string Name { get; set; }
Property Value
PreviousLayoutEngineIndex
The index of the layout engine in LayoutEngines which was previously active.
int PreviousLayoutEngineIndex { get; }
Property Value
WindowPositions
Map of windows to their WindowPositions.
ImmutableDictionary<HWND, WindowPosition> WindowPositions { get; }
Property Value
Windows
The windows in the workspace.
[Obsolete("Use the picker PickWorkspaceWindows instead.")]
IEnumerable<IWindow> Windows { get; }
Property Value
Methods
ActivatePreviouslyActiveLayoutEngine()
Activates previously active layout engine.
[Obsolete("Use ActivatePreviouslyActiveLayoutEngineTransform instead.")]
void ActivatePreviouslyActiveLayoutEngine()
AddWindow(IWindow)
Adds the window to the workspace.
[Obsolete("Use AddWindowToWorkspaceTransform instead.")]
bool AddWindow(IWindow window)
Parameters
window
IWindow
Returns
- bool
- Whether the
window
was added.
Remarks
Be careful of calling this outside of Whim's core code. It may cause the workspace to
become out of sync with the IButlerPantry.
DoLayout() is not called in this method.
ContainsWindow(IWindow)
Returns true when the workspace contains the provided
window
.[Obsolete("Use the picker PickWorkspaceWindows instead, and do a membership check instead.")]
bool ContainsWindow(IWindow window)
Parameters
window
IWindow- The window to check for.
Returns
- bool
- True when the workspace contains the provided
window
.
CycleLayoutEngine(bool)
Cycle to the next or previous layout engine.
[Obsolete("Use CycleLayoutEngineTransform instead.")]
void CycleLayoutEngine(bool reverse = false)
Parameters
reverse
bool- When true, activate the previous layout, otherwise activate the next layout. Defaults to false.
Deactivate()
Deactivates the workspace.
[Obsolete("This method will be removed in the future, and there is no planned replacement.")]
void Deactivate()
DoLayout()
Trigger a layout.
[Obsolete("Use DoWorkspaceLayoutTransform instead.")]
void DoLayout()
FocusLastFocusedWindow()
If LastFocusedWindow is not null or not minimized, then we focus the
last window in the workspace.
[Obsolete("Use FocusWindowTransform instead.")]
void FocusLastFocusedWindow()
FocusWindowInDirection(Direction, IWindow?, bool)
Focuses the
window
in the direction
.[Obsolete("Use FocusWindowInDirectionTransform instead.")]
bool FocusWindowInDirection(Direction direction, IWindow? window = null, bool deferLayout = false)
Parameters
direction
Direction- The direction to focus in.
window
IWindow- The origin window
deferLayout
bool- Whether to defer the layout until the next DoLayout(). Defaults to
false
.
Returns
- bool
- Whether the ActiveLayoutEngine changed.
MinimizeWindowEnd(IWindow)
Called when a window is being unminimized - i.e., the window size will no longer be
Minimized.
Will unminimize a window in the ActiveLayoutEngine.
[Obsolete("Use window.ShowNormal() instead.")]
void MinimizeWindowEnd(IWindow window)
Parameters
window
IWindow
Remarks
Be careful of calling this outside of Whim's core code. It may cause the workspace to
become out of sync with the IButlerPantry.
DoLayout() is not called in this method.
MinimizeWindowStart(IWindow)
Called when a window is being minimized - i.e., the window size will become
Minimized.
Will minimize a window in the ActiveLayoutEngine.
[Obsolete("Use window.ShowMinimized() instead.")]
void MinimizeWindowStart(IWindow window)
Parameters
window
IWindow
Remarks
Be careful of calling this outside of Whim's core code. It may cause the workspace to
become out of sync with the IButlerPantry.
DoLayout() is not called in this method.
MoveWindowEdgesInDirection(Direction, IPoint<double>, IWindow?, bool)
Change the
window
's edges
direction by
the specified deltas
.[Obsolete("Use MoveWindowEdgesInDirectionTransform instead - note that the coordinate space for deltas is different.")]
bool MoveWindowEdgesInDirection(Direction edges, IPoint<double> deltas, IWindow? window = null, bool deferLayout = false)
Parameters
edges
Direction- The edges to change.
deltas
IPoint<double>- The deltas to change the given
edges
by. When a value is positive, then the edge will move in the direction of theedges
. Thedeltas
have a coordinate space of [0, 1] for both x and y (the unit square). window
IWindow- The window to change the edge of. If null, the currently focused window is used.
deferLayout
bool- Whether to defer the layout until the next DoLayout(). Defaults to
false
.
Returns
- bool
- Whether the ActiveLayoutEngine changed.
MoveWindowToPoint(IWindow, IPoint<double>, bool)
Moves or adds the given
window
to the given point
.
The point has a coordinate space of [0, 1] for both x and y (the unit square).[Obsolete("Use MoveWindowToPointTransform instead - note that the coordinate space for the point is different.")]
bool MoveWindowToPoint(IWindow window, IPoint<double> point, bool deferLayout = false)
Parameters
window
IWindow- The window to move.
point
IPoint<double>- The point to move the window to.
deferLayout
bool- Whether to defer the layout until the next DoLayout(). Defaults to
false
.
Returns
- bool
- Whether the ActiveLayoutEngine changed.
PerformCustomLayoutEngineAction(LayoutEngineCustomAction)
Performs a custom action in a layout engine.
[Obsolete("Use LayoutEngineCustomActionTransform instead.")]
bool PerformCustomLayoutEngineAction(LayoutEngineCustomAction action)
Parameters
action
LayoutEngineCustomAction- Metadata about the action to perform, and the payload to perform it with.
Returns
- bool
- Whether the ActiveLayoutEngine changed.
Remarks
Layout engines need to handle the custom action in PerformCustomAction<T>(LayoutEngineCustomAction<T>).
For more, see PerformCustomAction<T>(LayoutEngineCustomAction<T>).
PerformCustomLayoutEngineAction<T>(LayoutEngineCustomAction<T>)
Performs a custom action in a layout engine.
[Obsolete("Use LayoutEngineCustomActionWithPayloadTransform instead.")]
bool PerformCustomLayoutEngineAction<T>(LayoutEngineCustomAction<T> action)
Parameters
action
LayoutEngineCustomAction<T>- Metadata about the action to perform, and the payload to perform it with.
Returns
- bool
- Whether the ActiveLayoutEngine changed.
Type Parameters
T
- The type of
action
's payload.
Remarks
Layout engines need to handle the custom action in PerformCustomAction<T>(LayoutEngineCustomAction<T>).
For more, see PerformCustomAction<T>(LayoutEngineCustomAction<T>).
RemoveWindow(IWindow)
Removes the window from the workspace.
[Obsolete("Use RemoveWindowFromWorkspaceTransform instead.")]
bool RemoveWindow(IWindow window)
Parameters
window
IWindow
Returns
- bool
- True when the window was removed.
Remarks
Be careful of calling this outside of Whim's core code. It may cause the workspace to
become out of sync with the IButlerPantry.
DoLayout() is not called in this method.
SwapWindowInDirection(Direction, IWindow?, bool)
Swaps the
window
in the direction
.[Obsolete("Use SwapWindowInDirectionTransform instead.")]
bool SwapWindowInDirection(Direction direction, IWindow? window = null, bool deferLayout = false)
Parameters
direction
Direction- The direction to swap the window in.
window
IWindow- The window to swap. If null, the currently focused window is swapped.
deferLayout
bool- Whether to defer the layout until the next DoLayout(). Defaults to
false
.
Returns
- bool
- Whether the ActiveLayoutEngine changed.
TryGetWindowState(IWindow)
Gets the current state (as of the last DoLayout()) of the window.
[Obsolete("Use the picker PickWindowPosition instead.")]
IWindowState? TryGetWindowState(IWindow window)
Parameters
window
IWindow
Returns
- IWindowState
- If the window is not in the workspace, or the workspace is not active,
null
is returned.
TrySetLayoutEngineFromIndex(int)
Rotate to the next layout engine.
[Obsolete("Use SetLayoutEngineFromIndexTransform instead.")]
bool TrySetLayoutEngineFromIndex(int nextIdx)
Parameters
nextIdx
int- The index of the layout engine to make active.
Returns
TrySetLayoutEngineFromName(string)
Tries to set the layout engine to one with the
name
.[Obsolete("Use SetLayoutEngineFromNameTransform instead.")]
bool TrySetLayoutEngineFromName(string name)
Parameters
name
string- The name of the layout engine to make active.