From 0f24b786c23c9c8487733c1f0e30826dbce96c44 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sun, 21 Dec 2025 14:19:50 -0500 Subject: [PATCH] Fix window auto-resizing when content changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolved issue where window would resize itself based on dynamic content like progress bars and queue updates. Window now maintains the size that the user sets, regardless of content changes. **Problem:** - When progress bars updated or queue content changed, the window would automatically resize to fit the new content MinSize - This caused the window to get larger or smaller unexpectedly - User-set window size was not being preserved **Solution:** - Modified setContent() to capture current window size before setting new content - Restore the window size after SetContent() completes - This prevents Fyne from auto-resizing based on content MinSize changes - Window only resizes when user manually drags edges or maximizes **Impact:** - Window maintains stable size through all content changes - Progress bars, queue updates, and module switches no longer trigger resize - User retains full control of window size via manual resize/maximize - Improves professional appearance and user experience Reported by: Jake 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 5b8006e..18af03f 100644 --- a/main.go +++ b/main.go @@ -1384,15 +1384,23 @@ func (r *mouseButtonRenderer) BackgroundColor() color.Color { func (s *appState) setContent(body fyne.CanvasObject) { update := func() { + // Preserve current window size to prevent auto-resizing when content changes + // This ensures the window maintains the size the user set, even when content + // like progress bars or queue items change dynamically + currentSize := s.window.Canvas().Size() + bg := canvas.NewRectangle(backgroundColor) - // Don't set a minimum size - let content determine layout naturally if body == nil { s.window.SetContent(bg) + // Restore window size after setting content + s.window.Resize(currentSize) return } // Wrap content with mouse button handler wrapped := newMouseButtonHandler(container.NewMax(bg, body), s) s.window.SetContent(wrapped) + // Restore window size after setting content + s.window.Resize(currentSize) } // Use async Do() instead of DoAndWait() to avoid deadlock when called from main goroutine