Skip to content

Conversation

@AryanRogye
Copy link
Owner

PanelProximity Optimizations,
Small Optimizations to Main Notch
Album Widget gets a major refactor for snapping/glitches in the UI

…different resolutions, this was happening cuz of the comapct album image height being too much to fit inside the notch when the notch is closed
@AryanRogye AryanRogye requested a review from Copilot July 11, 2025 21:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request addresses performance issues and UI glitches across the ComfyNotch application, focusing on optimizing panel proximity handling and refactoring the album widget for better display adaptation.

  • PanelProximityHandler performance optimizations with throttling and early exit conditions
  • Album widget refactoring to support dynamic sizing based on screen resolution
  • Minor UI optimizations and code cleanup in notch view and shell script

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Scripts/stats_longest_file.sh Code cleanup and optimization of the shell script with temporary file handling improvements
ComfyNotch/Widgets/CompactWidgets/CompactAlbumWidget.swift Major refactor introducing dynamic sizing based on screen resolution and new WidgetSizeConfig struct
ComfyNotch/Managers/UIManager.swift Minor comment cleanup in compact widget layout method
ComfyNotch/Main/ComfyNotchView.swift State tracking optimization and commented code removal
ComfyNotch/Handlers/PanelProximityHandler.swift Performance optimizations with throttling and streamlined condition checking
Comments suppressed due to low confidence (2)

ComfyNotch/Widgets/CompactWidgets/CompactAlbumWidget.swift:42

  • Variable names 'w' and 'h' are too abbreviated and unclear. Consider using more descriptive names like 'width' and 'height'.
        let w = resolution.width

ComfyNotch/Widgets/CompactWidgets/CompactAlbumWidget.swift:43

  • Variable names 'w' and 'h' are too abbreviated and unclear. Consider using more descriptive names like 'width' and 'height'.
        let h = resolution.height

Comment on lines 45 to 46

print("🖥️ Resolution: \(Int(w))x\(Int(h)), Expanded: \(isExpanded)")
Copy link

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

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

Debug print statement should be removed from production code. This will cause console spam and impact performance.

Suggested change
print("🖥️ Resolution: \(Int(w))x\(Int(h)), Expanded: \(isExpanded)")
// Debug print statement removed

Copilot uses AI. Check for mistakes.
Comment on lines 47 to 49
if w < 2800 {
return isExpanded ? .init(width: 20, height: 20) : .init(width: 15, height: 14)
} else if w <= 3500 {
Copy link

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

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

Magic numbers (2800, 3500) should be extracted as named constants to improve maintainability and explain their significance.

Suggested change
if w < 2800 {
return isExpanded ? .init(width: 20, height: 20) : .init(width: 15, height: 14)
} else if w <= 3500 {
if w < ScreenWidthThresholds.low {
return isExpanded ? .init(width: 20, height: 20) : .init(width: 15, height: 14)
} else if w <= ScreenWidthThresholds.high {

Copilot uses AI. Check for mistakes.
/// Throttling properties
private var lastProcessedTime: TimeInterval = 0
/// ~30fps (0.016 for 60)
private let throttleInterval: TimeInterval = 0.033
Copy link

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

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

Magic number 0.033 should be extracted as a named constant or calculated from a frame rate constant to make the relationship clearer.

Suggested change
private let throttleInterval: TimeInterval = 0.033
private let frameRate: Double = 30.0
private let throttleInterval: TimeInterval = 1.0 / frameRate

Copilot uses AI. Check for mistakes.
}


func widgetSize() -> WidgetSizeConfig {
Copy link

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

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

The widgetSize() function is called on every body evaluation and performs expensive screen queries. Consider caching the result or using a computed property that only recalculates when screen configuration changes.

Copilot uses AI. Check for mistakes.
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.

2 participants