LemonBoy / bar

A featherweight, lemon-scented, bar based on xcb
MIT License
1.62k stars 194 forks source link

Fixed multiline input #186

Closed dj95 closed 3 years ago

dj95 commented 8 years ago

Fixed Issue #107.

Added wm class string, so it's easier to handle lemonbar in compton, xdotool, etc.

LemonBoy commented 8 years ago

Also, the commit messages should be reworded

Other than that the PR looks fine, /hopefully/ it fixes the problem @woho has.

tryone144 commented 8 years ago

Reworded the commit messages and adopted coding style.

EDIT: The WM_CLASS atom has its own PR: https://github.com/LemonBoy/bar/pull/187

LemonBoy commented 8 years ago

This PR is about fixing the multiline issue, open another one for the WM_CLASS thing. Also, why there's a .diff in the changeset ?

tryone144 commented 8 years ago

Sorry, I've forgot to check the last commit. I will split the PR into two: multiline issue and WM_CLASS.

I haven't planned releasing this PR so soon, so the .diff is just a leftover I've forgot to delete prior the commit.

tryone144 commented 8 years ago

The WM_CLASS commits now have their own PR: https://github.com/LemonBoy/bar/pull/187

alexd2580 commented 5 years ago

I object to merging this PR, since with these changes the same bug will happen as has been observed by @LemonBoy in a slightly different context.

Your patch seems to break my statusbar [1] for some reason

[1] http://ix.io/gTm

The reason for this breakage is that the statusbar script uses echo -n multiple times to generate one single line. Therefore the input buffer of lemonbar will be filled partially multiple times with small delays inbetween.

With a blocking fgets, this problem mentioned above does not occur, because it waits for EOS or \n which is not sent until the complete line is terminated with an echo or with the statusbar script exiting and closing the pipe.

With a non-blocking fgets (proposed in this PR) the problem occurs: after each echo -n the input buffer is drained, thus reading, parsing and displaying a partial statusbar message.

While this does improve performance and fix the {echo a; echo b} | lemonbar -p-bug, as shown here, it also introduces race conditions into lemonbar, when using it with any status generator that uses multiple statements (echo, cout) to generate one single \n-terminated line and is even a little bit more complex than date | lemonbar.

tryone144 commented 3 years ago

This PR has been made redundant by the superior changes in https://github.com/LemonBoy/bar/commit/9e35bd6ccb9bd265322de960ff6276c4ec1af397. Please close.