Alexays / Waybar

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

Flickering/blinking when using sway hide mode and IPC #3750

Open mavaa opened 2 weeks ago

mavaa commented 2 weeks ago

Not sure if this belongs here or in the sway repo, but after one of the latest sway and/or waybar updates, my bar started flickering/blinking when hidden by sway. I've observed this on multiple machines, both with AMD and NVidia GPUs. I'm using this configuration for sway to have the bar show/hide when I use the win key:

bar {
    swaybar_command waybar
    mode hide
    position top

}

I've also minified my waybar config to try to identify if anything triggers it. This config at least reproduces it:

// -*- mode: jsonc -*-
{
    "spacing": 0, // Gaps between modules (4px)
    "ipc": true,
    "modules-left": [
        "sway/workspaces",
        "sway/mode",
        "sway/scratchpad",
    ],
    "modules-center": [
        "sway/window"
    ],
    "modules-right": [
        "mpris",
        "pulseaudio",
        "memory",
        "temperature",
        "keyboard-state",
        "battery",
        "battery#bat2",
        "clock",
        "tray"
    ],
}

Removing the tray item sometimes seems to fix the issue, and stopping nm-applet greatly reduced the flickering, but after restarting sway a few times it sometimes comes back. And even when not flickering, very often a black bar stays where the waybar used to be. It seems almost as if the more stuff I add to my config, the worse it gets. Moving the mouse to the screen with flickering often (but not always) removes it. I tried to capture some video of the issue, but due to framerate and/or the fact that OBS is recording the screen, it doesn't pick up the full effect:

https://github.com/user-attachments/assets/832cc2d4-52bd-42e4-8328-105747547dec

In reality, when looking on my monitor, the black line observed at the top is flickering on and off like crazy, several times per second. I also have a stylesheet with catppuccin theme added in the video above, but the same issue still happened if I removed it.

lkp26k commented 1 week ago

Have the same problem. Tried to fix it the last three days. I'm exhausted about it. I'd be very grateful for anything remotely helpful.

waybar -l debug shows that the visibility state is switched correctly. I was assuming something in the GTK direction, but that's a blind guess and fiddling there wasn't successful.

I'm on Arch with Intel/Nvidia (nouveau) GPU. I'm new to this, so I don't know what information is relevant to share - just let me know :)

Edit: The screen capture mavaa did is a very good representation of what I see as well. The bar should be hidden but a black shadow bar remains. At the position where modules are normally, the black shadow parts sometimes disappear. I tried it with a most minimal bar (just a clock) and build it up from there. The more modules I added (especially system stuff, eg memory, cpu, ...) the worse it got. I couldn't find a breaking point - the behavior just worsened.

wkordalski commented 1 week ago

I have the same issue on NixOS/unstable with AMD integrated graphics.

I've checked that this commit to nixpkgs introduces the bug on my system. The commit updates sway (from 1.9 to 1.10) and wlroots (from 0.17 to 0.18).

Maybe this helps someone to fix this issue.

SeabertYuan commented 12 hours ago

I was struggling with this problem too, and unfortunately I think this is a duplicate of #3492. I had to just accept not hiding my bar for now.