shdown / luastatus

universal status bar content generator
GNU General Public License v3.0
295 stars 12 forks source link

multiple intances of luastatus running #46

Closed lieux closed 5 years ago

lieux commented 5 years ago

I tried reloading i3 for a couple of times. And upon checking htop, I now have multiple instances of luastatus running.

shdown commented 5 years ago

This is just threads.

You can see this by noting that:

lieux commented 5 years ago

You're right. But I don't see threaded-ml.

lieux commented 5 years ago

I did some investigation. Doing ps -C luastatus after a couple of refreshes really return multiple instances. But I figured a workaround and just placed this in my i3 config: status_command exec bash -c '[[ ! -z $(pgrep -x luastatus) ]] && pkill -x luastatus; luastatus-i3-wrapper -B no_separators ~/.config/luastatus/i3bar/*.lua || luastatus-i3-wrapper -B no_separators ~/.config/luastatus/i3bar/*.lua'

shdown commented 5 years ago

What i3 version do you use?

lieux commented 5 years ago

I'm using the latest stable release i3-gaps-4.16.1-1.

lieux commented 5 years ago

My guess is that whenever I reload i3, the status_command executes again and, thus, running another luastatus process.

shdown commented 5 years ago

By “reload” you mean doing i3-msg reload, right?

I don’t know what the problem is yet, but what’s the point of this part of your script? luastatus-i3-wrapper -B no_separators ~/.config/luastatus/i3bar/*.lua || luastatus-i3-wrapper -B no_separators ~/.config/luastatus/i3bar/*.lua

This is redundant because, in normal circumstances, luastatus will not terminate until i3bar wants it to. Probably the problem is in your status_command script.

Could you please paste the status_command string of the configuration where the problem reproduces?

My guess is that whenever I reload i3, the status_command executes again and, thus, running another luastatus process.

But before executing status_command again, i3bar sends SIGTERM to the previous instance, thus doing exactly the right thing.

lieux commented 5 years ago

In my i3 config, I combined reload and restart in one binding. I guess that's the culprit: bindsym $mod+F5 reload restart

This was my status_command before replacing it: status_command exec luastatus-i3-wrapper -B no_separators ~/.config/luastatus/i3bar/*.lua

shdown commented 5 years ago

What’s the reason of closing?