Andeskjerf / waybar-module-pomodoro

A pomodoro timer intended for Waybar
The Unlicense
21 stars 3 forks source link

countdown does not start #11

Closed Anwar1663 closed 2 months ago

Anwar1663 commented 2 months ago

I have been getting this error message: Error: Os { code: 111, kind: ConnectionRefused, message: "Connection refused" } whenever I try to interact with the module (when using: start, pause, toggle...)

It usually works only for the first time after compiling the module but the issue starts after I reboot (or logout.)

I'm using waybar in arch linux.

Andeskjerf commented 2 months ago

So it only works once, but after rebooting / logging out, it breaks permanently?

What's the output of this command? Do the sockets exist? ls /tmp | grep -i waybar-module-pomodoro

Do you have any scripts that sends any signals to waybar?

If you start the module in the terminal, are you able to interact with it using any operations?

In one terminal window, waybar-module-pomodoro

In another, waybar-module-pomodoro toggle

Anwar1663 commented 2 months ago

i have tried messing around but nothing seemed to work, as far as I can tell, it works randomly (works one time and breaks several times after).

when I ran the command ls /tmp | grep -i waybar-pomodoro I got this output waybar-pomodoro0.socket waybar-pomodoro1.socket

when the module was running properly I got this output instead waybar-pomodoro0.socket

(I changed the name so I can write it out faster, but the issue was present before I changed anything)

Anwar1663 commented 2 months ago

I get the same Connection Refused error when I try to running and interacting with the module inside the terminal.

Andeskjerf commented 2 months ago

Do you have multiple monitors?

If you temporarily remove the module from waybar and then start it via the terminal and exit it, does it remove the sockets on exit and make new ones when it starts?

Anwar1663 commented 2 months ago

No, I do not have multiple monitors.

I think I know what causes the issue, when I log out, and log back in, The socked number is incremented by one (it spawns a new sockets) . meaning that it only breaks when I logout, and I have to Reboot the computer to get it to work again.

If I exit waybar, the socket is removed, the same thing happens when I launch the module from the terminal. However, when I log out, the socket is not removed, so when I log in, another socket is spawned that breaks the waybar-module-pomodoro toggle command and the other commands

Andeskjerf commented 2 months ago

Hmm... So it works, until you log out? I wasn't able to reproduce that on my end, the sockets are cleared on log out and new ones are made once I log back in. Could be related to how one logs out? I use hyprland myself so the command I use for logging out is hyprctl dispatch exit 0. Not sure what that does under the hood, but it works. How are you logging out?

I assume that when you log out, the socket is still there? Before logging back in? In order to support multiple monitors, the module creates a socket for each monitor so that each module on every monitor has a socket to accept messages from. I see now that if the module fails to make a connection to a socket, it'll error out and crash, even if there are other sockets that could accept a message. I'll look into fixing that now!

Still not sure why the sockets are not cleared when you log out though.

Andeskjerf commented 2 months ago

Could you test if that PR works on your machine? It doesn't fix the issue with leftover sockets, but hopefully it should at least fix the problem where everything breaks because it couldn't connect to the leftover socket.

Anwar1663 commented 2 months ago

the command I use for logging out is loginctl terminate-user user when I tried loggin out using hyprctl dispatch exit 0 the module worked, so I will just logout using that command instead. thank you for your help.

Andeskjerf commented 2 months ago

Glad to hear it works now :)

I couldn't reproduce it even with that command, so that's odd. If you have the time to spare, I'd appreciate it if you could test the PR! Curious to hear if it resolves the problem with the original log out command.

Anwar1663 commented 2 months ago

I tested the PR and it works just fine with both commands. well done!

Andeskjerf commented 2 months ago

Great! Thanks for testing it out!