Refactor DPI-awareness setup with fallback support for compatibility across Windows versions. Introduce detailed monitor descriptions and update UI logic to use standardized display names. Add error notifications for improved user feedback during window management tasks. |
||
|---|---|---|
| cmd | ||
| internal | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| README.md | ||
SaveMyWindows
A lightweight Windows utility that rescues, centers, and reassigns application windows that have become inaccessible due to ghost monitors, DPI changes, or broken multi-monitor layouts in Windows 11.
Built with Fyne for a fast native UI + system tray, and Win32 APIs for direct window management.
Problem Statement
Windows 11 occasionally leaves application windows positioned on:
- disconnected monitors
- invalid virtual desktop coordinates
- DPI-mismatched monitor spaces
These windows become impossible to click or drag back without killing the app, changing display settings, or using obscure keyboard shortcuts.
SaveMyWindows provides a reliable, always-reachable recovery tool via the system tray.
Core Goals
Primary Goals
- Always-available system tray utility
- One-click rescue of off-screen windows
- Ability to center all visible windows onto a chosen monitor
- Ability to move a specific window to a selected monitor
Non-Goals
- Not a full window manager
- No tiling, snapping, or layout persistence
- No background hooks or system services
- No attempts to bypass Windows security restrictions
Feature Set
System Tray (Primary Interface)
- Rescue all off-screen windows → Primary monitor
- Rescue all off-screen windows → Selected monitor
- Center all windows → Selected monitor
- Open Window Picker UI
- Exit
Tray actions must work even if the main window is lost or off-screen.
Window Picker UI
A minimal Fyne window for precise control:
- List of detected top-level windows
- Window title
- Process name / PID
- Monitor selection dropdown
- Actions:
- Move to monitor
- Center on monitor
- Clamp inside monitor work area
Window Handling Rules
Only real application windows are targeted.
Included:
- Visible top-level windows
- Standard Win32 desktop apps
- Most modern desktop applications
Excluded:
- Tool windows / owned popups
- Invisible or cloaked windows
- Taskbars, docks, overlays
- Secure desktop / UAC prompts
- Windows that explicitly refuse repositioning
Failures are expected and treated as non-fatal.
Monitor Handling
- Enumerates all connected monitors
- Uses monitor work areas (not full bounds)
- Prevents taskbar overlap
- Supports mixed-DPI setups
- A window is considered off-screen if it intersects no monitor work area
Move Modes
- Center
- Centers the window in the target monitor's work area
- Clamp
- Preserves window size
- Ensures the entire window remains visible
- (Optional future) Keep Relative
- Preserves relative position from original monitor
Technical Architecture
UI Layer
- Fyne
- System tray icon and menus
- Minimal picker window
- UI contains no window-management logic
Platform Layer (Windows-only)
All Win32 interaction is isolated in a single package:
internal/winwm/
windows.go
monitors.go
rescue.go
Responsibilities:
- Enumerate windows
- Enumerate monitors
- Detect off-screen windows
- Move / center windows
- Handle DPI awareness
UI code only calls exported functions.
Platform Scope
| OS | Support |
|---|---|
| Windows 11 | Primary target |
| Windows 10 | Likely works, not guaranteed |
| macOS | Not planned |
| Linux | Not planned |
SaveMyWindows is a Windows-first utility.
Known Limitations
- Cannot move some elevated/admin windows unless run elevated
- Cannot affect secure desktop or system UI
- DPI edge cases on extreme mixed-DPI setups
- Some UWP or shell windows may behave inconsistently
All limitations are expected and documented.
Development Phases
Phase 1 — Core Rescue
- System tray icon
- Monitor enumeration
- Off-screen detection
- Rescue → Primary monitor
Phase 2 — Bulk Actions
- Center all windows
- Rescue → Selected monitor
Phase 3 — Precision Control
- Window picker UI
- Per-window move / center
Phase 4 — Polish
- Improved window filtering
- Error reporting / logging
- Icon and basic branding
- README screenshots
Philosophy
- Utility over aesthetics
- Safe defaults
- No invasive hooks
- No persistent state unless necessary
- If Windows says “no”, accept it and move on