Skip to content

Fix clock not displaying in certain situations #3482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 25, 2025

Conversation

onesounds
Copy link
Contributor

🛠 Fix clock not displaying on first launch (when animation is enabled)

  • When HideOnStartup = off and Animation = on, there was a bug where the clock would not appear at all on the initial launch.
  • After the first launch, the clock behaves normally.
  • This PR addresses the issue by forcibly triggering the animation on OnLoaded, ensuring the clock becomes visible on the first load.

⚠️ Notes

  • Even after this fix, the animation might appear to be missing due to rendering timing.
    If you slow down the animation duration, you’ll notice it’s actually running.
  • Adjusting the position of the animation trigger within OnLoaded can make the animation look better.
    However, doing so caused a slight delay in visibility when animation was disabled.
  • While a more refined fix is possible, it would increase complexity.
    Since the clock does show up correctly, and this is the key UX issue, no further changes were made.

💡 UX Consideration

  • The lack of visible animation on the first load is likely due to rendering timing and is not perceived as unnatural by most users.
  • If users ask, just say:
    "The animation was too fast because your PC is so fast." 😄

@prlabeler prlabeler bot added the bug Something isn't working label Apr 22, 2025
@onesounds onesounds added the kind/ui related to UI, icons, themes, etc label Apr 22, 2025

This comment has been minimized.

Copy link

gitstream-cm bot commented Apr 22, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

Copy link
Contributor

coderabbitai bot commented Apr 22, 2025

📝 Walkthrough

Walkthrough

A conditional check was added to the OnLoaded event handler in the main window code. Now, after displaying the main view model window, the WindowAnimation() method is called only if the animation setting is enabled in the application's settings. Additionally, the order of calls in WindowAnimation() was corrected to set the animation targets properly without changing the animation logic or control flow. No public interfaces were altered.

Changes

File(s) Change Summary
Flow.Launcher/MainWindow.xaml.cs Added conditional call to WindowAnimation() in OnLoaded based on animation setting; corrected order and method calls for setting storyboard targets in WindowAnimation().

Possibly related PRs

Suggested reviewers

  • onesounds

Poem

A window springs to life anew,
With animation—if you choose!
A hop, a skip, a gentle show,
Only when the settings say so.
Rabbits love a subtle flair,
When windows open with some care!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4f39c0a and e3dbdae.

📒 Files selected for processing (1)
  • Flow.Launcher/MainWindow.xaml.cs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher/MainWindow.xaml.cs
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: build
✨ 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.

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.

@taooceros
Copy link
Member

Could we just set the location of the clock on load rather than running the animation?

@onesounds
Copy link
Contributor Author

Could we just set the location of the clock on load rather than running the animation?

You want to just show it without any animation? This involves changing the alpha value and making an exception for the initial launch timing, so it could potentially affect the existing show/hide logic. Are you sure that’s okay? Later on, during maintenance, we’ll probably have to come back and work on this part separately. If you’re fine with that, I’ll go ahead and do it.

@onesounds
Copy link
Contributor Author

@coderabbitai Review it. Please also review taooceros's suggestion and include that in the discussion.

Copy link
Contributor

coderabbitai bot commented Apr 23, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Examine the PR changes in MainWindow.xaml.cs
git show 0a41072f33a7196402db93e2266a8f9d52ca2b13 -- Flow.Launcher/MainWindow.xaml.cs

Length of output: 43842


@onesounds I've reviewed the code change and taooceros's suggestion. Here's my analysis:

Current Implementation (Running Animation)

Your implementation calls WindowAnimation() in the OnLoaded event when animations are enabled. This effectively reuses existing code to ensure the clock is visible on initial launch.

if (_settings.UseAnimation)
{
    WindowAnimation();
}

Alternative Suggestion (Direct Positioning)

taooceros suggested directly setting the clock's position/opacity rather than running the animation. This would mean:

  1. Setting final opacity values directly (ClockPanel.Opacity = 1.0)
  2. Setting final margin values (ClockPanel.Margin = new Thickness(...))
  3. Setting SearchIcon position and opacity

Analysis of Both Approaches

Current implementation (pros/cons):

✅ Reuses existing animation logic
✅ Maintains consistency with how the clock is shown in other scenarios
✅ Less chance of introducing discrepancies between initial and subsequent displays
❌ Runs a potentially heavy animation when just setting values might suffice

Direct positioning (pros/cons):

✅ Potentially more efficient (no animation overhead)
✅ More explicit and straightforward for the specific use case
❌ Would require duplicating final state values from the animation code
❌ Creates a special case for initial launch that might need separate maintenance
❌ Could become inconsistent with the rest of the show/hide logic

Recommendation

Your current approach is likely the safer option because:

  1. The animation code already handles all the complexity of setting correct margins, opacity, etc.
  2. Creating special case logic for the initial launch could lead to maintenance issues
  3. The performance impact of running one animation on startup is minimal

Unless there's a specific performance concern with the animation, sticking with the current implementation keeps the code more consistent and maintainable.

This comment has been minimized.

@Jack251970 Jack251970 added Dev branch only An issue or fix for the Dev branch build and removed bug Something isn't working labels Apr 23, 2025
@Jack251970 Jack251970 added this to the 1.20.0 milestone Apr 23, 2025

This comment has been minimized.

Copy link

gitstream-cm bot commented Apr 25, 2025

🥷 Code experts: Jack251970

Jack251970, onesounds have most 👩‍💻 activity in the files.
Jack251970, onesounds have most 🧠 knowledge in the files.

See details

Flow.Launcher/MainWindow.xaml.cs

Activity based on git-commit:

Jack251970 onesounds
APR 63 additions & 42 deletions
MAR 1141 additions & 1076 deletions 327 additions & 141 deletions
FEB 1 additions & 1 deletions 8 additions & 4 deletions
JAN
DEC 5 additions & 10 deletions
NOV

Knowledge based on git-blame:
Jack251970: 65%
onesounds: 15%

To learn more about /:\ gitStream - Visit our Docs

@Jack251970
Copy link
Contributor

Could we just set the location of the clock on load rather than running the animation?

You want to just show it without any animation? This involves changing the alpha value and making an exception for the initial launch timing, so it could potentially affect the existing show/hide logic. Are you sure that’s okay? Later on, during maintenance, we’ll probably have to come back and work on this part separately. If you’re fine with that, I’ll go ahead and do it.

I tried other methods but none of them can help. If you think this can fix all things, I agree with you to use this.

@Jack251970 Jack251970 requested a review from Copilot April 25, 2025 04:09
Copy link
Contributor

@Copilot 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 PR fixes an issue where the clock fails to appear on first launch when animation is enabled by triggering the window animation explicitly in the OnLoaded event.

  • Forcibly calls WindowAnimation() when _settings.UseAnimation is true
  • Ensures initialization of the clock's visibility on startup

This comment has been minimized.

@Jack251970 Jack251970 requested a review from Copilot April 25, 2025 08:32
Jack251970
Jack251970 previously approved these changes Apr 25, 2025
Copy link
Contributor

@Copilot 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 PR fixes a bug where the clock did not display on the first launch when animation is enabled by forcibly triggering the animation in OnLoaded.

  • Forces animation trigger in OnLoaded when UseAnimation is enabled.
  • Updates Storyboard target assignments in WindowAnimation for clarity.

This comment has been minimized.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors Count
❌ forbidden-pattern 24
⚠️ non-alpha-in-dictionary 19

See ❌ Event descriptions for more information.

Forbidden patterns 🙅 (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

s.b. workaround(s)

\bwork[- ]arounds?\b
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@onesounds onesounds enabled auto-merge April 25, 2025 08:36
@onesounds onesounds merged commit 95d82b3 into Flow-Launcher:dev Apr 25, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dev branch only An issue or fix for the Dev branch build kind/ui related to UI, icons, themes, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants