Window Enumerator Formatter
A powerful formatting library for window information with multiple output formats and template support. Works standalone or integrates with window-enumerator.
Features ✨
- 🎨 Multiple Formats: JSON, YAML, CSV, Table, Simple, and Detailed formats
- 🎯 Template System: Field selection, key-value pairs, and custom templates
- 🔧 Highly Configurable: Title truncation, header control, and output customization
- 🚀 Easy to Use: Simple API with rich examples and builder pattern
- 📦 Flexible: Works standalone or with
window-enumeratorintegration - 🔌 Optional Dependencies: Minimal required dependencies
Installation
Add this to your Cargo.toml:
[]
= "0.1"
For window-enumerator integration, enable the feature:
[]
= { = "0.1", = ["window-enumerator"] }
= "0.4"
Quick Start
Standalone Usage
use ;
use PathBuf;
// Create window data using builder pattern
let window = builder
.hwnd
.pid
.title
.class_name
.process_name
.process_file
.index
.position
.build;
let windows = vec!;
// Format with different output formats
println!;
println!;
println!;
With window-enumerator Integration
use WindowEnumerator;
use ;
Usage Examples
Multiple Output Formats
use ;
let windows = get_windows; // Your window data
// All available formats
println!;
println!;
println!;
println!;
println!;
println!;
println!;
Template System
use ;
let window = builder
.hwnd
.pid
.title
.build;
// Field values only (tab-separated)
let config = FormatConfig ;
println!;
// Output: "1 1234 My Application"
// Key-value pairs
let config = FormatConfig ;
println!;
// Output: "index: 1 | hwnd: 0x12345 | title: My Application"
// Custom template string
let config = FormatConfig ;
println!;
// Output: "Window[1] | PID:1234 | Title:My Application"
Advanced Configuration
use ;
let windows = get_windows;
// Custom configuration
let config = FormatConfig ;
println!;
Available Template Fields
Use these field names in custom templates:
{index}- Window index{hwnd}- Window handle (hex format){pid}- Process ID{title}- Window title{class}- Window class name{process}- Process name{file}- Process file path{x},{y}- Window position{width},{height}- Window size
Examples
Run the provided examples to see the library in action:
# Basic usage
# All output formats
# Custom templates
# Advanced configuration
# With window-enumerator integration
Features
- default: No additional dependencies
- window-enumerator: Enables integration with
window-enumeratorcrate - all: Enables all features
Supported Formats
| Format | Description | Use Case |
|---|---|---|
| JSON | Compact JSON format | APIs, data exchange |
| JSON Pretty | Formatted JSON with indentation | Debugging, configuration |
| YAML | YAML format | Configuration files |
| CSV | Comma-separated values | Spreadsheets, data analysis |
| Table | Formatted table | Command-line display |
| Simple | One-line format | Logging, quick overview |
| Detail | Multi-line detailed format | Debugging, full information |
| Custom | Template-based format | Custom output requirements |
Documentation
License
MIT License - see LICENSE file for details.
This project is licensed under either of