Skip to content

Comments

Fix windows not opening on Windows Machines#36

Merged
iamEvanYT merged 4 commits intomainfrom
evan/debug-build
May 8, 2025
Merged

Fix windows not opening on Windows Machines#36
iamEvanYT merged 4 commits intomainfrom
evan/debug-build

Conversation

@iamEvanYT
Copy link
Member

@iamEvanYT iamEvanYT commented May 8, 2025

closes #34

Summary by CodeRabbit

  • Documentation
    • Added new documentation outlining window border radius and tab component padding values.
  • Style
    • Adjusted padding in the main content area for improved spacing.
    • Reduced width of the sidebar hover detection area for finer interaction.
  • Refactor
    • Simplified window visibility logic for main, onboarding, and settings windows to streamline display behavior.
    • Reorganized CSS class application in the browser content component for improved maintainability.
  • Chores
    • Enabled debug prints in all builds and added more detailed debug logging during app initialization.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 8, 2025

Walkthrough

This update modifies window visibility handling in the main and onboarding processes, ensuring windows are shown immediately or only after they are ready. It adds extensive debug logging during app initialization, always enables debug prints, and adjusts minor UI details such as border radius documentation, padding, and sidebar hover width.

Changes

Files / Grouped Files Change Summary
docs/references/window-border.md Added new documentation outlining window border radius and tab padding values.
src/main/browser/window.ts, src/main/onboarding/main.ts, src/main/settings/main.ts Refactored window creation: removed explicit hide() calls and adjusted show option to simplify and clarify window visibility, ensuring windows are shown at appropriate times.
src/main/index.ts, src/main/modules/flags.ts, src/main/modules/output.ts Added detailed debug logging throughout app initialization, always enabled debug prints by setting SHOW_DEBUG_PRINTS to true, and introduced a new debug area flag for initialization. Removed early exit on "electron-squirrel-startup".
src/renderer/src/components/browser-ui/browser-content.tsx, src/renderer/src/components/browser-ui/main.tsx, src/renderer/src/components/browser-ui/sidebar/hover-detector.tsx Adjusted UI details: reordered CSS class application for border radius, reduced main content padding, and narrowed sidebar hover detection area.

Sequence Diagram(s)

sequenceDiagram
    participant App as Main Process
    participant BrowserWindow
    participant OnboardingWindow

    App->>BrowserWindow: Create (without show: false)
    BrowserWindow-->>App: Emits "ready-to-show"
    App->>BrowserWindow: Show and focus window

    App->>OnboardingWindow: Create (with show: true)
    Note right of OnboardingWindow: Window is immediately visible
Loading

Assessment against linked issues

Objective Addressed Explanation
Ensure the app opens with a window on startup instead of running hidden (#34)

Poem

A window appears, no longer shy,
Debug prints sparkle as logs fly by.
Borders are rounded, paddings are neat,
Sidebar’s slimmer, a UI treat!
With every tweak and every show,
This bunny hops—let windows glow! 🐇✨

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
docs/references/window-border.md (1)

3-5: Enhance documentation clarity.
The bullet list correctly notes pixel values but lacks context about which elements use each radius/padding. Consider expanding points into descriptive sentences or grouping under subheadings (e.g.:

  • Default window border radius: 4px
  • setBorderRadius(): applies 8px
  • Tab component padding: 8px in main.tsx)
    to improve readability and maintainability.
src/main/modules/flags.ts (1)

26-26: Debug prints now always enabled

You've changed the SHOW_DEBUG_PRINTS flag from a conditional value based on !app.isPackaged to a constant true. This means debug prints will now be shown in production builds as well.

This change is reasonable for debugging the window opening issue on Windows machines, but you may want to consider adding a TODO comment to revert this change once the Windows issue is resolved, or implementing a more sophisticated logging mechanism for production.

-  SHOW_DEBUG_PRINTS: true,
+  SHOW_DEBUG_PRINTS: true, // TODO: Revert to !app.isPackaged after Windows issue is fixed
src/main/onboarding/main.ts (1)

48-56: Potentially redundant show call

The onboarding.show() method still calls onboardingWindow.show() even though the window is now created with show: true. This is harmless but redundant.

Consider removing or refactoring this to be more explicit about the intent.

export const onboarding = {
  show: async () => {
    if (!onboardingWindow) {
      await createOnboardingWindow();
    }

    if (!onboardingWindow) return;
    onboardingWindow.show(); // This is now redundant since the window is created with show:true
    onboardingWindow.focus();
  },
src/main/index.ts (1)

11-196: Consider conditional debug logging for production builds.

With SHOW_DEBUG_PRINTS now always enabled (per the summary), these debug messages will appear in production builds. While helpful for diagnosing this issue, consider adding a condition to disable these logs in production once the issue is resolved.

- import { debugPrint } from "@/modules/output";
+ import { debugPrint, FLAGS } from "@/modules/output";

// Then in appropriate places:
- debugPrint("INITIALIZATION", "message");
+ if (!app.isPackaged || FLAGS.ENABLE_EXTENDED_DEBUGGING) {
+   debugPrint("INITIALIZATION", "message");
+ }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d28727 and 568f5c2.

📒 Files selected for processing (10)
  • docs/references/window-border.md (1 hunks)
  • src/main/browser/window.ts (1 hunks)
  • src/main/index.ts (4 hunks)
  • src/main/modules/flags.ts (1 hunks)
  • src/main/modules/output.ts (1 hunks)
  • src/main/onboarding/main.ts (1 hunks)
  • src/main/settings/main.ts (0 hunks)
  • src/renderer/src/components/browser-ui/browser-content.tsx (1 hunks)
  • src/renderer/src/components/browser-ui/main.tsx (1 hunks)
  • src/renderer/src/components/browser-ui/sidebar/hover-detector.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • src/main/settings/main.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/main/index.ts (2)
src/main/modules/output.ts (1)
  • debugPrint (22-28)
src/main/onboarding/main.ts (1)
  • onboarding (47-83)
🔇 Additional comments (11)
src/renderer/src/components/browser-ui/sidebar/hover-detector.tsx (1)

30-30: Verify hover detection width on Windows.
Reducing the hover detector width from w-2 (8px) to w-1.5 (6px) tightens the UI but could reduce hover-trigger reliability, particularly on Windows devices. Please validate this change on actual Windows machines and ensure w-1.5 is recognized in your Tailwind configuration (JIT mode or custom spacing).

src/renderer/src/components/browser-ui/main.tsx (1)

86-86: Approve padding adjustment and verify consistency with docs.
Changing the container padding from p-2.5 (10px) to p-2 (8px) aligns with the 8px padding specified in docs/references/window-border.md. This standardizes spacing across the UI. Please double-check that this reduced padding does not negatively affect content layouts in other screen sizes or states.

src/renderer/src/components/browser-ui/browser-content.tsx (1)

30-31: Approve class reordering.
Extracting "rounded-lg" into its own argument in the cn() call does not alter rendered styles and improves readability by logically separating the border-radius utility from the rest of the class list.

src/main/modules/output.ts (1)

5-5: Good addition of initialization debug area

Adding the INITIALIZATION debug area will help track app startup, which is likely related to the window opening issue.

This aligns well with the changes to make debug prints always visible, and will provide valuable diagnostic information.

src/main/browser/window.ts (2)

72-72: Window show behavior modification

You've removed the explicit show: false option from the BrowserWindow constructor. This allows the window to be immediately visible upon creation, rather than being initially hidden.

This is likely a key fix for the Windows window opening issue, as it simplifies the window visibility management by removing the need to manually hide and show the window in succession.


119-122: Window visibility strategy change

The window is now shown only when it's ready to display content, preventing flash of empty content while maintaining responsiveness.

This approach is cleaner and more reliable across platforms, especially on Windows where the previous hide/show sequence may have been causing issues.

src/main/onboarding/main.ts (1)

18-18: Window visibility approach made consistent

Setting show: true in the onboarding window options is consistent with the changes in the main window creation. This unified approach to window visibility management likely addresses the root cause of windows not opening on Windows machines.

This is a good practice to maintain consistency across the codebase.

src/main/index.ts (4)

11-11: Good addition of debugPrint for troubleshooting.

Adding the debugPrint import enables the detailed logging that follows, which is essential for diagnosing the window opening issues on Windows machines.


136-136: Well-placed debug logging helps diagnose window visibility issues.

The strategically placed debug logs throughout the initialization process provide excellent visibility into the application startup flow, particularly around window creation and visibility. These logs will help identify exactly where the window display process might be failing on Windows machines.

I notice these logs align with the window visibility changes mentioned in the summary (changing windows to be shown immediately rather than waiting for 'ready-to-show'), which directly addresses the core issue of windows not appearing on Windows machines.

Also applies to: 148-148, 177-177, 182-182, 188-198


150-150: Comment formatting improvement.

The comment is now properly formatted and aligned with other comments in the codebase.


134-141:

Details

❓ Verification inconclusive

Verify single instance behavior still works properly.

The code no longer exits early on "electron-squirrel-startup" detection (according to the summary), but still exits if it couldn't get the single instance lock. Please verify that this change doesn't affect Windows installation or update processes.


🏁 Script executed:

#!/bin/bash
# Check for any squirrel-related code that might have been removed
rg -A 2 -B 2 "electron-squirrel-startup" --type ts

Length of output: 50


🏁 Script executed:

#!/bin/bash
# Thoroughly search for any remaining “electron-squirrel-startup” import or require in TS files
rg -n "import ['\"]electron-squirrel-startup['\"]" --type ts
rg -n "require\(['\"]electron-squirrel-startup['\"]\)" --type ts

Length of output: 137


Verify Windows installer/update behavior

I searched the entire codebase and found no remaining imports or requires for electron-squirrel-startup. Since the early exit on squirrel events appears fully removed, please manually confirm that Windows installation and auto-updates still run correctly, and that the single-instance lock logic (in initializeApp) doesn’t interfere with those workflows.

@iamEvanYT iamEvanYT merged commit 6dd7347 into main May 8, 2025
1 check passed
@iamEvanYT iamEvanYT deleted the evan/debug-build branch May 8, 2025 20:02
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.

App not opening on some Windows Machines

1 participant