Output to terminal
p4vook opened this issue · comments
Is it possible to output statusline to stdout using escape color sequences?
That would allow using xmobar inside wayland.
I was thinking about status_command in waybar, just like i3status, but not quite i3status :)
I've looked at the sources for 10 minutes and I wasn't able to trace the actual rendering to "text" (probably some markup type) process.
i've created a new branch named text and implemented there basic text
output to stdout. it doesn't support colours yet, but the basics are
there. it also simply concatenates the left, center and right
segments; with a textOutputWidth configuration parameter it shouldn't
be difficult to add some aligment too, but not sure how useful that is
in this case. to make xmobar output to stdout, one just either passes
the flag -T to its invocation, or sets textOutput=True in the
configuration file.
I've checked out text
branch. In general, it works :), but sway fails to update the status line, I'm trying to debug this issue. It seems like it has some trouble reading from xmobar.
Please read https://manpages.debian.org/testing/sway/swaybar-protocol.7.en.html. This is a JSON-based protocol for status bar, used initially for i3bar and now, with some changes listed in the man page, for swaybar.
I still think that terminal output is useful, but it seems that Sway does not render escape sequences. Swaybar-protocol also allows for some features like clicking support.
Looks like the problem is that swaybar is chunking data in 8192-byte blocks and then processing it all. I will continue debugging this problem.
I know that's not the real fix, but replacing xmobar -T
with unbuffer xmobar -T
makes the buffering problem disappear.
@jaor no, that does not work: "escape" in waybar escapes only pango markup, not ANSI escape symbols.
The buffering problem still persists and I even managed to create simple reproducible test for it:
echo "" | xmobar -T | cat
buffers in batches of 8192 bytes.
I've found a fix to buffering: just set line-buffering in startTextLoop.
buffering-fix.patch.txt