Skip to content

refactor(aumate-app): apply DDD architecture for window vibrancy#12

Merged
sealday merged 5 commits intomainfrom
refactor/window-resize
Dec 17, 2025
Merged

refactor(aumate-app): apply DDD architecture for window vibrancy#12
sealday merged 5 commits intomainfrom
refactor/window-resize

Conversation

@sealday
Copy link
Contributor

@sealday sealday commented Dec 17, 2025

Rust Backend (4-Layer DDD):

  • Add WindowVibrancyPort trait and VibrancyEffect enum in Domain Layer
  • Implement WindowVibrancyAdapter using Tauri v2 WindowEffects API
  • Create SetWindowVibrancyUseCase in Application Layer
  • Refactor set_window_vibrancy command to use Use Case
  • Remove window-vibrancy crate, use built-in Tauri v2 windowEffects

Frontend (3-Layer Architecture):

  • Create services/window.ts as API Layer for Tauri commands
  • Add useWindowResize hook with HTML-based animations
  • Refactor lib/window.ts to re-export from services (backward compat)
  • Add CSS animation classes for smooth window resize transitions

🤖 Generated with Claude Code


Note

Implements DDD-based window vibrancy via Tauri v2 window effects and adds an HTML/CSS resize flow, replacing the window-vibrancy crate and wiring a new API/adapter/use cases end-to-end.

  • Backend:
    • Domain/Use Cases: Add VibrancyEffect and WindowVibrancyPort; implement SetWindowVibrancyUseCase and GetWindowVibrancyStateUseCase.
    • Infrastructure: Add WindowVibrancyAdapter using Tauri v2 set_effects; tracks window registration/state.
    • API: New set_window_vibrancy Tauri command; wire adapter/use cases into AppState and setup.
    • Runtime Effects: Apply platform-specific WindowEffectsConfig to settings and commandpalette in lib.rs.
    • Deps: Remove window-vibrancy crate; rely on built-in Tauri effects.
  • Frontend:
    • Services: New services/window.ts (resizeAndCenter, animateResizeAndCenter, setWindowSizeImmediate, setVibrancy, getWindowSize); lib/window.ts re-exports for compatibility.
    • UI/UX: Add useWindowResize hook for smooth HTML-based resize; temporarily disables vibrancy during animation; update CommandPalette to use it.
    • Styles: Add .window-content animation classes in index.css; remove rounded corners from app/settings wrappers.
  • Config:
    • tauri.conf.json: enable "shadow": true for commandpalette window.

Written by Cursor Bugbot for commit 8ca2b79. This will update automatically on new commits. Configure here.

Rust Backend (4-Layer DDD):
- Add WindowVibrancyPort trait and VibrancyEffect enum in Domain Layer
- Implement WindowVibrancyAdapter using Tauri v2 WindowEffects API
- Create SetWindowVibrancyUseCase in Application Layer
- Refactor set_window_vibrancy command to use Use Case
- Remove window-vibrancy crate, use built-in Tauri v2 windowEffects

Frontend (3-Layer Architecture):
- Create services/window.ts as API Layer for Tauri commands
- Add useWindowResize hook with HTML-based animations
- Refactor lib/window.ts to re-export from services (backward compat)
- Add CSS animation classes for smooth window resize transitions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

}
};
initSize();
}, []);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Initial window size is zero causing wrong animation

The hook initializes currentSizeRef to { width: 0, height: 0 } and asynchronously fetches the actual window size via getWindowSize(). However, the consuming component's useEffect immediately calls resizeTo on mount, racing with the initialization. Since getWindowSize() involves IPC calls, resizeTo typically executes before initialization completes. This causes isGrowing to always be true (since any positive dimension exceeds 0), resulting in unnecessary vibrancy toggling and potentially the wrong animation direction on first load when the window may actually be shrinking.

Fix in Cursor Fix in Web

sealday and others added 2 commits December 17, 2025 17:45
- Set windowEffects.radius to 12px in tauri.conf.json for settings and commandpalette
- Update WindowVibrancyAdapter to apply DEFAULT_WINDOW_RADIUS (12px) when enabling vibrancy
- Change CSS border-radius from rounded-lg (8px) to rounded-xl (12px) to match native window
- Fixes visible white edges in corners caused by mismatch between CSS and native window radius

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…dius

- Remove rounded-xl from App.tsx and SettingsApp.tsx containers
- Let windowEffects.radius handle corner clipping at native level
- Fixes gray acrylic showing through CSS rounded corners

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
sealday and others added 2 commits December 17, 2025 17:54
On Windows 11, undecorated windows need shadow: true to have rounded corners.
The settings window had shadow enabled (default) and showed rounded corners,
while commandpalette had shadow: false causing square corners.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1. Move windowEffects from tauri.conf.json to runtime initialization
   - Remove static windowEffects config (was Windows-only "acrylic")
   - Apply platform-specific effects in lib.rs setup:
     - Windows: Acrylic with radius 12px
     - macOS: HudWindow with radius 12px
     - Linux: No effects (fallback)

2. Fix useWindowResize hook issues:
   - Add isAnimatingRef guard to prevent concurrent resize calls
   - Handle uninitialized size (0,0) by treating as growing animation
   - Only update currentSizeRef on successful resize
   - Export isInitialized state for consumers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sealday sealday merged commit fdad929 into main Dec 17, 2025
3 checks passed
// Guard against concurrent calls
if (isAnimatingRef.current) {
return;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Dropped resize requests cause incorrect window dimensions

The resizeTo function silently returns early when isAnimatingRef.current is true, dropping the resize request entirely. When combined with the React effect that calls resizeTo when mode changes, this creates a race condition: if the user switches modes (via Tab key) while an animation is in progress, the new resize request is discarded and the effect won't re-run after the animation completes because mode hasn't changed again. The window remains at the previous mode's dimensions instead of the current mode's dimensions.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant