Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.61k stars 705 forks source link

Hyprland/workspaces: active workspace bug #2484

Open zjeffer opened 1 year ago

zjeffer commented 1 year ago

There seems to be an issue with active-only after https://github.com/Alexays/Waybar/pull/2408 has been implemented - you will see all active workspaces for the fraction of a second while switching from an active workspace to an empty one.

@NotAShelf

NotAShelf commented 1 year ago

This might be a problem with Hyprland's IPC, think an issue about this has been reported to the Hyprland developer.

NotAShelf commented 1 year ago

Nevermind, seems I was referring to https://github.com/hyprwm/Hyprland/issues/3212#issuecomment-1711739363

zjeffer commented 1 year ago

Hey @NotAShelf can you share a minimum reproducable config for this issue? I'd like to take a look at fixing this, as it looks like you're complaining about it quite a lot on the Hyprland discord ;)

NotAShelf commented 1 year ago

sorry it's been the most annoying thing xd

here's what I have rn

hyprland/workspaces": {
    "on-click": "activate",
    "on-scroll-down": "hyprctl dispatch workspace m-1",
    "on-scroll-up": "hyprctl dispatch workspace m+1"
    "active-only": true,
    "all-outputs": true,
    "format": "{icon}",
    "format-icons": {
        "1": "一",
        "10": "十",
        "2": "二",
        "3": "三",
        "4": "四",
        "5": "五",
        "6": "六",
        "7": "七",
        "8": "八",
        "9": "九"
     },
}

I assume you've seen the video I've posted demonstrating the bug, given you are on the discord.

zjeffer commented 1 year ago

The problem doesn't seem to happen only with active_only = true, but it happens any time you switch from an active workspace to an empty one. With active_only, it's just more apparant because you're constantly creating and destroying workspaces.

I believe the cause is when switching to a new workspace and destroying the old one, Hyprland sends two events: the createworkspace event and the destroyworkspace event. We're updating the bar when the createworkspace event happens, and again when the destroyworkspace event happens. createworkspace seems to be called first, which updates the bar with the new workspace, but the old workspace is not yet removed from the bar. Only by the time the destroyworkspace event is triggered, does the old workspace get deleted. The flickering you're seeing is the time between those two events.

I always use persistent workspaces, so my workspaces never get removed from the bar, which is why I never saw this bug.

I'm not sure what the solution is for this, but I'll investigate further.

yavorski commented 3 days ago

Yeah, Switching between two empty workspaces fast, causes undesired glitch effect, because the both of them are visible for a short time, until the one is cleared. Note this does not happen under sway, only in hyprland.