/winman-windows

A platform-agnostic event-based window management library for .NET (Windows/Win32 implementation)

Primary LanguageC#MIT LicenseMIT

WinMan (Windows/Win32 implementation) Logo

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.


WinMan is a dependency of FancyWM.

Example 1

Prints added, removed and initially present windows over the course of 10 seconds.

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.

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);
}