-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename ProxyFloatingLayoutPlugin into FloatingWindowPlugin
- Loading branch information
Showing
17 changed files
with
220 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# 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. | ||
|
||
The <xref:Whim.FloatingLayout.FloatingWindowPlugin> has no configuration options. | ||
|
||
![Floating window demo](../../images/floating-window-demo.gif) | ||
|
||
Notice that this plugin is not related to the `FloatingLayoutEngine`. | ||
|
||
## 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> | |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/Whim.FloatingLayout.Tests/FloatingWindowCommandsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using AutoFixture; | ||
using NSubstitute; | ||
using Whim.TestUtils; | ||
using Xunit; | ||
|
||
namespace Whim.FloatingLayout.Tests; | ||
|
||
public class FloatingWindowCommandsCustomization : ICustomization | ||
{ | ||
public void Customize(IFixture fixture) | ||
{ | ||
IFloatingWindowPlugin plugin = fixture.Freeze<IFloatingWindowPlugin>(); | ||
plugin.Name.Returns("whim.floating_window"); | ||
fixture.Inject(plugin); | ||
} | ||
} | ||
|
||
public class FloatingWindowCommandsTests | ||
{ | ||
private static ICommand CreateSut(IFloatingWindowPlugin plugin, string id) => | ||
new PluginCommandsTestUtils(new FloatingWindowCommands(plugin)).GetCommand(id); | ||
|
||
[Theory, AutoSubstituteData<FloatingWindowCommandsCustomization>] | ||
public void ToggleWindowFloatingCommand(IFloatingWindowPlugin plugin) | ||
{ | ||
// Given | ||
ICommand command = CreateSut(plugin, "whim.floating_window.toggle_window_floating"); | ||
|
||
// When | ||
command.TryExecute(); | ||
|
||
// Then | ||
plugin.Received(1).ToggleWindowFloating(null); | ||
} | ||
|
||
[Theory, AutoSubstituteData<FloatingWindowCommandsCustomization>] | ||
public void MarkWindowAsFloatingCommand(IFloatingWindowPlugin plugin) | ||
{ | ||
// Given | ||
ICommand command = CreateSut(plugin, "whim.floating_window.mark_window_as_floating"); | ||
|
||
// When | ||
command.TryExecute(); | ||
|
||
// Then | ||
plugin.Received(1).MarkWindowAsFloating(null); | ||
} | ||
|
||
[Theory, AutoSubstituteData<FloatingWindowCommandsCustomization>] | ||
public void MarkWindowAsDockedCommand(IFloatingWindowPlugin plugin) | ||
{ | ||
// Given | ||
ICommand command = CreateSut(plugin, "whim.floating_window.mark_window_as_docked"); | ||
|
||
// When | ||
command.TryExecute(); | ||
|
||
// Then | ||
plugin.Received(1).MarkWindowAsDocked(null); | ||
} | ||
} |
Oops, something went wrong.