francma / wob

A lightweight overlay volume/backlight/progress/anything bar for Wayland.
ISC License
896 stars 49 forks source link

Two bars on dual monitor setup #104

Closed aivarsV closed 1 year ago

aivarsV commented 1 year ago

I have following wob.ini contents

timeout = 10000
max = 100
anchor = top
margin = 32
background_color = 1e2132af
border_color = 84a0c6ef
bar_color = 84a0c6ef
overflow_background_color = 1e2132af
overflow_border_color = 84a0c6ef
overflow_bar_color = e2a478bf

And on dual monitor setup it produces two bars. It might always produce two bars, but it is only visible, when I have two monitors enabled and margin set. Screenshot for reference

scrn

I'm on river wm, if that matters.

francma commented 1 year ago

I'm unable to reproduce the issue on my system. How do you start wob? Is it possible that 2 instances of wob with different configs are running?

aivarsV commented 1 year ago

I did a little bit of testing and here is what I've found out:

This is log with two screens

 ~  $ wob -v
1668972577.575927 INFO  main.c:506: wob version 0.13 started
1668972577.576016 INFO  config.c:294: Found configuration file at $HOME/.config/wob/wob.ini
1668972577.576031 INFO  main.c:515: Using configuration file at /home/vaivis/.config/wob/wob.ini
4
1668972581.356350 INFO  main.c:626: Received input { value = 4, bg = #1e2132af, border = #84a0c68f, bar = #84a0c6ef }
1668972581.356401 INFO  main.c:650: Rendering { value = 4, bg = #1e2132af, border = #84a0c68f, bar = #84a0c6ef }
1668972581.356540 INFO  main.c:302: Showing bar on output focused
1668972581.356597 INFO  main.c:302: Showing bar on output focused
1668972582.358609 INFO  main.c:284: Hiding bar on output focused
1668972582.358670 INFO  main.c:284: Hiding bar on output focused
5
1668972591.897677 INFO  main.c:626: Received input { value = 5, bg = #1e2132af, border = #84a0c68f, bar = #84a0c6ef }
1668972591.897765 INFO  main.c:650: Rendering { value = 5, bg = #1e2132af, border = #84a0c68f, bar = #84a0c6ef }
1668972591.897798 INFO  main.c:302: Showing bar on output focused
1668972591.897822 INFO  main.c:302: Showing bar on output focused
1668972592.901663 INFO  main.c:284: Hiding bar on output focused
1668972592.901716 INFO  main.c:284: Hiding bar on output focused
5
1668972599.413591 INFO  main.c:626: Received input { value = 5, bg = #1e2132af, border = #84a0c68f, bar = #84a0c6ef }
1668972599.413626 INFO  main.c:650: Rendering { value = 5, bg = #1e2132af, border = #84a0c68f, bar = #84a0c6ef }
1668972599.413678 INFO  main.c:302: Showing bar on output focused
1668972599.413725 INFO  main.c:302: Showing bar on output focused
1668972600.416289 INFO  main.c:284: Hiding bar on output focused
1668972600.416328 INFO  main.c:284: Hiding bar on output focused
1668972604.339733 INFO  main.c:601: Received EOF

And this is with one:

 ~  $ wob -v
1668972611.991459 INFO  main.c:506: wob version 0.13 started
1668972611.991521 INFO  config.c:294: Found configuration file at $HOME/.config/wob/wob.ini
1668972611.991538 INFO  main.c:515: Using configuration file at /home/vaivis/.config/wob/wob.ini
4
1668972614.152591 INFO  main.c:626: Received input { value = 4, bg = #1e2132af, border = #84a0c68f, bar = #84a0c6ef }
1668972614.152638 INFO  main.c:650: Rendering { value = 4, bg = #1e2132af, border = #84a0c68f, bar = #84a0c6ef }
1668972614.152955 INFO  main.c:302: Showing bar on output focused
1668972615.154955 INFO  main.c:284: Hiding bar on output focused
W
1668972624.717767 ERROR main.c:619: Received invalid input

Notice how there are two info messages stating that bar is being shown and hidden, when in two monitor setup and only one such message, when I had single monitor. I must say, that I'm not entirely sure from wich source this issue originates - wob's or river's.

francma commented 1 year ago

I see where the problem is now. The "fake" focused output is added every time the physical one is connected. I'm able to reproduce this on sway by doing:

swaymsg output eDP-1 disable
swaymsg output eDP-1 enable

a few times while wob is running.

This commit should fix the issue https://github.com/francma/wob/commit/29e2536e45b64eaea4bf4fad6b8a4cbabf056c65 and I'll do a new bugfix release soon.

Thank you for your report :thumbsup: