Skip to content
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

[Bug] "catching-up" on wake and bar freeze when using window manager providers #54

Closed
CtByte opened this issue Apr 14, 2024 · 5 comments
Labels
help wanted Extra attention is needed type: bug Something isn't working

Comments

@CtByte
Copy link
Contributor

CtByte commented Apr 14, 2024

Description
When I wake my laptop from a long sleep it seem like that requests to update the bar are piled up and executed in a rapid manner.

To reproduce

  1. I set the CPU provider to display a more accurate reading in order to reproduce this issue
    <span>{{cpu.usage.toFixed(3)}}%</span>
  2. I left my laptop in sleep mode for 1-3 hours.
  3. When I wake my laptop the bar executes the piled up readings that did not get to update the bar yet.

Video of the bug

7e8c8957-15d4-4a56-a37a-24b17cda798e.mp4

I suspect it might have something to do with the code here, I am not sure.

Perhaps the solution is to introduce a timeout on the callback to the provider, so after some time the result is ignored or the call simply abandoned.

@NMedvesky
Copy link

Also experiencing this catching up bug after my computer wakes up from sleeping. And glazewm provider not working after waking up from sleeping, requiring zebar to be refreshed to receive workspace updates from glazewm. I am using glazewm v3.0.0 and Zebar 1.7.0. Perhaps zebar needs to automatically be refreshed after waking up from sleep, or just the code for the glazewm provider.

@CtByte
Copy link
Contributor Author

CtByte commented Aug 1, 2024

I have the same experience still.

The Komorebi provider also "freezes" everything, but with the recent changes it seems less frequent.
I also noticed this freezing issue without letting my computer to go to sleep. After some time, the bar stops updating and when I click the bar and then click a window it does this "catching up".

I am assuming that there must be something about the code that handles updating the bar for both the Komorebi and Glazevm providers. When I don't use the Komorebi provider the bar is much more stable.

@lars-berger Would there be a way I can help tracking down this issue? (I will try to capture this again when it happens without the computer going to sleep)

I use this for Komorebi (seems to work better with 2 monitors)

    template/komorebi:
      providers: ['komorebi']
      template: |
        <div class="template-block">
            @for (monitor of komorebi.allMonitors) {
              @if (self.args.MONITOR_NAME.endsWith(monitor.name)) {
                <div title="Self: {{self.args.MONITOR_NAME}} | {{monitor.name}}({{monitor.focusedWorkspaceIndex}})">
                  @for (workspace of monitor.workspaces) {<div title="{{workspace.layout}}" class="workspace {{monitor.workspaces.indexOf(workspace) === monitor.focusedWorkspaceIndex && 'active'}}">
                      {{workspace.name || "&nbsp;"}}
                    </div>}
                </div>
              }
            }
        </div>

@CtByte
Copy link
Contributor Author

CtByte commented Aug 3, 2024

@lars-berger I managed to catch this behaviour without putting the computer to sleep.

Recording.2024-08-03.081756.mp4

It was stuck for a while before I started recording, but once I started, it ran the UI updates rapidly (by default it should update every 2 seconds).
I switched between clicking the bar and the Firefox window and the UI updates get stuck sometimes. This only seem to happen when I use the Komorebi provider.

Just to be clear, when I don't use the Komorebi provider, then this "catching-up" happens after waking from sleep, but it does not get stuck in the middle. When I use the Komorebi provider then this happens even without sleep.

Could this be related to when Komorebi pushes an update in the socket connection, the UI thread in Zebar gets stuck?

Komorebi made the interface public, so I was wondering if using that instead of the socket connection can fix this issue, but this could very well be a thread locking issue?

@CtByte CtByte changed the title [Bug] "Catching up" bug on providers bug: "catching-up" on wake and bar freeze when using vm providers Aug 6, 2024
@CtByte CtByte changed the title bug: "catching-up" on wake and bar freeze when using vm providers bug: "catching-up" on wake and bar freeze when using window manager providers Aug 6, 2024
@CtByte
Copy link
Contributor Author

CtByte commented Aug 6, 2024

@lars-berger I ran Zebar locally to see the logs and try to reproduce the issue. I use the Komorebi provider and when the bar gets stuck I see the following error after the bar starts catching up (as seen in the video previously)

packages/desktop dev: 2024-08-06T08:19:47.704072Z  WARN tao::platform_impl::platform::event_loop::runner: NewEvents emitted without explicit RedrawEventsCleared
packages/desktop dev: 2024-08-06T08:19:47.709268Z  WARN tao::platform_impl::platform::event_loop::runner: RedrawEventsCleared emitted without explicit MainEventsCleared

Komorebi provider:

    template/komorebi-focused-window:
      providers: ['komorebi']
      template: |
        <div style="background: white; color: black;">
          <div class="">
            <span>{{ komorebi.focusedWorkspace.tilingContainers[komorebi.focusedWorkspace.focusedContainerIndex]?.windows[0]?.title ?? "-" }}</span>
          </div>
        </div>

Not sure if this is relevant., but I think that it is important to note that this does not happen right away. Zebar needs to run for a while, but this always happens eventually, forcing me to avoid the Komorebi provider.

@lars-berger lars-berger added type: bug Something isn't working state: available labels Aug 10, 2024
@lars-berger lars-berger changed the title bug: "catching-up" on wake and bar freeze when using window manager providers [Bug] "catching-up" on wake and bar freeze when using window manager providers Aug 11, 2024
@lars-berger lars-berger added help wanted Extra attention is needed and removed state: available labels Aug 11, 2024
@CtByte
Copy link
Contributor Author

CtByte commented Sep 18, 2024

Both the freezing issue and the catch-up issue are gone with the v2 🎉

@CtByte CtByte closed this as completed Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type: bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants