Skip to content

Commit

Permalink
Rename FloatingLayout to FloatingWindow, and FreeLayout to FloatingLa…
Browse files Browse the repository at this point in the history
…yout (#961)

**BREAKING CHANGE**

This PR renames the following items:

- `Whim.FloatingLayout` plugin to `Whim.FloatingWindow`
- `Whim.FloatingLayout.FloatingLayoutEngine` to `Whim.FloatingWindow.ProxyFloatingLayoutEngine`
- `Whim.FreeLayoutEngine` layout engine to `Whim.FloatingLayout`

This is in preparation to share logic between the `FloatingWindow` plugin and the `FloatingLayout` layout engine.

---------

Co-authored-by: Isaac Daly <isaac.daly@outlook.com>
  • Loading branch information
Lukinoh and dalyIsaac authored Aug 4, 2024
1 parent 731d95a commit ac6e2e8
Show file tree
Hide file tree
Showing 37 changed files with 433 additions and 426 deletions.
4 changes: 2 additions & 2 deletions Whim.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.Gaps", "src\Whim.Gaps\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.Tests", "src\Whim.Tests\Whim.Tests.csproj", "{B2BA068D-D77A-4B7B-9B64-2C23701F48B5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.FloatingLayout", "src\Whim.FloatingLayout\Whim.FloatingLayout.csproj", "{636EA561-2625-4D2A-9A8A-890E5AEF18B9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.FloatingWindow", "src\Whim.FloatingWindow\Whim.FloatingWindow.csproj", "{636EA561-2625-4D2A-9A8A-890E5AEF18B9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.Runner", "src\Whim.Runner\Whim.Runner.csproj", "{D74F1389-F4D1-4A1C-ACE3-D91D70472DBB}"
ProjectSection(ProjectDependencies) = postProject
Expand Down Expand Up @@ -43,7 +43,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.CommandPalette.Tests",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.TreeLayout.Bar", "src\Whim.TreeLayout.Bar\Whim.TreeLayout.Bar.csproj", "{4F66FB22-C4B3-494F-BEE0-9F878349621E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.FloatingLayout.Tests", "src\Whim.FloatingLayout.Tests\Whim.FloatingLayout.Tests.csproj", "{2E407C3C-FCE9-4851-9091-61C6CC687AFD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.FloatingWindow.Tests", "src\Whim.FloatingWindow.Tests\Whim.FloatingWindow.Tests.csproj", "{2E407C3C-FCE9-4851-9091-61C6CC687AFD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.Gaps.Tests", "src\Whim.Gaps.Tests\Whim.Gaps.Tests.csproj", "{3771BD98-746A-446D-BEA9-22C97B719299}"
EndProject
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/contribute/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ To use your existing configuration, make sure to update the `#r` directives to p
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\whim.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.Bar\Whim.Bar.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.CommandPalette\Whim.CommandPalette.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.FloatingLayout\Whim.FloatingLayout.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.FloatingWindow\Whim.FloatingWindow.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.FocusIndicator\Whim.FocusIndicator.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.Gaps\Whim.Gaps.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.LayoutPreview\Whim.LayoutPreview.dll"
Expand All @@ -64,7 +64,7 @@ To use your existing configuration, make sure to update the `#r` directives to p
// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\whim.dll"
// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.Bar\Whim.Bar.dll"
// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.CommandPalette\Whim.CommandPalette.dll"
// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.FloatingLayout\Whim.FloatingLayout.dll"
// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.FloatingWindow\Whim.FloatingWindow.dll"
// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.FocusIndicator\Whim.FocusIndicator.dll"
// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.Gaps\Whim.Gaps.dll"
// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.LayoutPreview\Whim.LayoutPreview.dll"
Expand All @@ -79,7 +79,7 @@ Alternatively, the `#r` directives can be specified using a magic path prefix `W
#r "WHIM_PATH\whim.dll"
#r "WHIM_PATH\plugins\Whim.Bar\Whim.Bar.dll"
#r "WHIM_PATH\plugins\Whim.CommandPalette\Whim.CommandPalette.dll"
#r "WHIM_PATH\plugins\Whim.FloatingLayout\Whim.FloatingLayout.dll"
#r "WHIM_PATH\plugins\Whim.FloatingWindow\Whim.FloatingWindow.dll"
#r "WHIM_PATH\plugins\Whim.FocusIndicator\Whim.FocusIndicator.dll"
#r "WHIM_PATH\plugins\Whim.Gaps\Whim.Gaps.dll"
#r "WHIM_PATH\plugins\Whim.LayoutPreview\Whim.LayoutPreview.dll"
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/customize/layout-engines.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ context.PluginManager.AddPlugin(treeLayoutPlugin);

![TreeLayoutEngine demo](../../images/tree-layout-demo.gif)

### `FreeLayoutEngine`
### `FloatingLayoutEngine`

<xref:Whim.FreeLayoutEngine> is a layout that has all windows being free-floating. To have specific windows float within a different layout, see the [Floating Layout Plugin](../plugins/floating-layout.md).
<xref:Whim.FloatingLayout.FloatingLayoutEngine> is a layout that has all windows being free-floating. To have specific windows float within a different layout, see the [Floating Window Plugin](../plugins/floating-window.md).

![FreeLayoutEngine demo](../../images/free-layout-demo.gif)
![FloatingLayoutEngine demo](../../images/floating-layout-demo.gif)
4 changes: 2 additions & 2 deletions docs/docs/getting-started/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ context.PluginManager.AddPlugin(barPlugin);
```

| Plugin | TL;DR |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
|--------------------------------------------------------------------------| ------------------------------------------------------------------------------------------------- |
| [Bar](../plugins/bar.md) | Adds a configurable bar to the top of each screen |
| [Command Palette](../plugins/command-palette.md) | Fuzzy command palette filled with [commands](../customize/commands.md) |
| [Floating Layout](../plugins/floating-layout.md) | Lets windows float outside other layout engines |
| [Floating Window](../plugins/floating-window.md) | Lets windows float outside other layout engines |
| [Focus](../plugins/focus-indicator.md) | Adds a border around the current window |
| [Gaps](../plugins/gaps.md) | Adds gaps between windows |
| [Layout Preview](../plugins/layout-preview.md) | Shows a preview when dragging windows |
Expand Down
37 changes: 0 additions & 37 deletions docs/docs/plugins/floating-layout.md

This file was deleted.

37 changes: 37 additions & 0 deletions docs/docs/plugins/floating-window.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Floating Window Plugin

The <xref:Whim.FloatingLayout.FloatingWindowPlugin> adds a `ProxyFloatingLayoutEngine` proxy engine to Whim. This adds the ability for windows to float outside of any other layouts. If you want to have a layout of free-floating windows, see the <xref:Whim.FloatingLayout.FloatingLayoutEngine>.

The <xref:Whim.FloatingLayout.FloatingWindowPlugin> has no configuration options.

![Floating window demo](../../images/floating-window-demo.gif)

## Example Config

```csharp
#r "WHIM_PATH\whim.dll"
#r "WHIM_PATH\plugins\Whim.FloatingLayout\Whim.FloatingLayout.dll"

using Whim;
using Whim.FloatingLayout;

void DoConfig(IContext context)
{
// ...
FloatingWindowPlugin floatingWindowPlugin = new(context);
context.PluginManager.AddPlugin(floatingWindowPlugin);

// ...
}

return DoConfig;
```

## Commands

| Identifier | Title | Keybind |
|------------------------------------------------| ----------------------- | ------------------------------------------------ |
| `whim.floating_window.toggle_window_floating` | Toggle window floating | <kbd>Win</kbd> + <kbd>Shift</kbd> + <kbd>F</kbd> |
| `whim.floating_window.mark_window_as_floating` | Mark window as floating | <kbd>Win</kbd> + <kbd>Shift</kbd> + <kbd>M</kbd> |
| `whim.floating_window.mark_window_as_docked` | Mark window as docked | <kbd>Win</kbd> + <kbd>Shift</kbd> + <kbd>D</kbd> |
2 changes: 1 addition & 1 deletion docs/docs/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ items:
- name: Plugins
- href: plugins/bar.md
- href: plugins/command-palette.md
- href: plugins/floating-layout.md
- href: plugins/floating-window.md
- href: plugins/focus-indicator.md
- href: plugins/gaps.md
- href: plugins/layout-preview.md
Expand Down
Binary file modified docs/images/floating-layout-demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/floating-window-demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/free-layout-demo.gif
Binary file not shown.
61 changes: 0 additions & 61 deletions src/Whim.FloatingLayout.Tests/FloatingLayoutCommandsTests.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
using Whim.TestUtils;
using Windows.Win32.Foundation;

namespace Whim.FloatingLayout.Tests;
namespace Whim.FloatingWindow.Tests;

public class BaseFloatingLayoutEngineTests : ProxyLayoutEngineBaseTests
public class BaseProxyFloatingLayoutEngineTests : ProxyLayoutEngineBaseTests
{
public override Func<ILayoutEngine, BaseProxyLayoutEngine> CreateLayoutEngine =>
(inner) =>
{
IContext context = Substitute.For<IContext>();
IMonitor monitor = Substitute.For<IMonitor>();
IInternalFloatingLayoutPlugin plugin = Substitute.For<IInternalFloatingLayoutPlugin>();
IInternalFloatingWindowPlugin plugin = Substitute.For<IInternalFloatingWindowPlugin>();
ILayoutEngine innerLayoutEngine = Substitute.For<ILayoutEngine>();

context
Expand All @@ -21,6 +21,6 @@ public class BaseFloatingLayoutEngineTests : ProxyLayoutEngineBaseTests
monitor.WorkingArea.Returns(new Rectangle<int>() { Width = 1000, Height = 1000 });
innerLayoutEngine.Identity.Returns(new LayoutEngineIdentity());

return new FloatingLayoutEngine(context, plugin, innerLayoutEngine);
return new ProxyFloatingLayoutEngine(context, plugin, innerLayoutEngine);
};
}
Loading

0 comments on commit ac6e2e8

Please sign in to comment.