https://github.com/fancywm/winman-windows
A platform-agnostic event-based window management library for .NET (Windows/Win32 implementation)
https://github.com/fancywm/winman-windows
Last synced: 8 months ago
JSON representation
A platform-agnostic event-based window management library for .NET (Windows/Win32 implementation)
- Host: GitHub
- URL: https://github.com/fancywm/winman-windows
- Owner: FancyWM
- License: mit
- Created: 2021-03-20T11:42:21.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-12T09:14:57.000Z (about 2 years ago)
- Last Synced: 2025-03-28T13:36:59.586Z (about 1 year ago)
- Language: C#
- Homepage: https://fancywm.github.io/winman-windows/WinMan.Windows.html
- Size: 9.37 MB
- Stars: 12
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WinMan (Windows/Win32 implementation) 
### WinMan - a window management library for .NET with the following features:
- Platform-agnostic design
- Event-based API
- Designed to be used by window management software
### See the [Documentation](https://fancywm.github.io/winman-windows/WinMan.Windows.html).
---
### WinMan is a dependency of [FancyWM](https://www.microsoft.com/en-us/p/fancywm/9p1741lkhqs9).
## Example 1
Prints added, removed and initially present windows over the course of 10 seconds.
```csharp
using System;
using WinMan;
using WinMan.Windows;
void TestWinMan()
{
using IWorkspace workspace = new Win32Workspace();
workspace.WindowManaging += (s, e) =>
{
Console.WriteLine($"Window {e.Source} initially present on the workspace!");
};
workspace.WindowAdded += (s, e) =>
{
Console.WriteLine($"Window {e.Source} added to the workspace!");
};
workspace.WindowRemoved += (s, e) =>
{
Console.WriteLine($"Window {e.Source} removed from the workspace!");
};
workspace.Open();
Thread.Sleep(100000);
}
```
## Example 2
Listens to changes to an empty notepad window.
```csharp
using System;
using WinMan;
using WinMan.Windows;
void TestWinMan()
{
using IWorkspace workspace = new Win32Workspace();
workspace.Open();
var notepad = workspace.GetSnapshot().First(x => x.Title == "Notepad -- Untitled");
notepad.StateChanged += (s, e) =>
{
Console.WriteLine($"Notepad is now {e.NewState}!");
};
Thread.Sleep(100000);
}
```