Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tmux-weather plugin. #43

Open
kierun opened this issue Apr 30, 2020 · 19 comments
Open

Support tmux-weather plugin. #43

kierun opened this issue Apr 30, 2020 · 19 comments

Comments

@kierun
Copy link

kierun commented Apr 30, 2020

Source

Supporting that plugin would be great.

@kierun
Copy link
Author

kierun commented Apr 30, 2020

Here is a screen shot of me doing just that. I replaced the date (which I do not need) with the weather:

screenshot

All working but for the e at the end of the status. No idea how to get ride of it…

@nikita-y
Copy link

nikita-y commented Apr 30, 2020

Hey @kierun I have a very similar solution without problem with the 'e' at the end
Also I used -ga option to split the lines. It helps a lot when you playing with the parameters.

#+--- Bars ---+
set -g status-left "#[fg=black,bg=blue,bold] #S "
set -ga status-left '#[fg=black,bg=blue]#{?window_zoomed_flag, Z ,}'
set -ga status-left "#[fg=blue,bg=black,nobold,noitalics,nounderscore]"

set -g status-right  "#{prefix_highlight}"
set -ga status-right "#[fg=brightblack,bg=black,nobold,noitalics,nounderscore]"
set -ga status-right "#[fg=white,bg=brightblack] %a %b %d "
set -ga status-right "#[fg=white,bg=brightblack,nobold,noitalics,nounderscore]"
set -ga status-right "#[fg=white,bg=brightblack] #{weather}"
set -ga status-right "#[fg=cyan,bg=brightblack,nobold,noitalics,nounderscore]"
set -ga status-right "#[fg=black,bg=cyan,bold] %H:%M "

#+--- Windows ---+
set -g window-status-format  "#[fg=black,bg=brightblack,nobold,noitalics,nounderscore] "
set -ga window-status-format "#[fg=white,bg=brightblack]#I "
set -ga window-status-format "#[fg=white,bg=brightblack,nobold,noitalics,nounderscore] "
set -ga window-status-format "#[fg=white,bg=brightblack]#W #F "
set -ga window-status-format "#[fg=brightblack,bg=black,nobold,noitalics,nounderscore]"

set -g window-status-current-format  "#[fg=black,bg=cyan,nobold,noitalics,nounderscore] "
set -ga window-status-current-format "#[fg=black,bg=cyan]#I "
set -ga window-status-current-format "#[fg=black,bg=cyan,nobold,noitalics,nounderscore] "
set -ga window-status-current-format "#[fg=black,bg=cyan]#W #F "
set -ga window-status-current-format "#[fg=cyan,bg=black,nobold,noitalics,nounderscore]"

I hope it will help

@kierun
Copy link
Author

kierun commented Apr 30, 2020

Hey @kierun I have a very similar solution without problem with the 'e' at the end

Thank you! I removed all my lines, added yours, and the "e" vanished. Sadly, it was replaced by "n"!

Running tmux 3.1, in case that's an issue…

Also I used -ga option to split the lines. It helps a lot when you playing with the parameters.

Now, that is a superb option! Thank you.

@kierun
Copy link
Author

kierun commented Apr 30, 2020

Itrestingly enough, messing around some options, I got this:

Untitled

Colour me confused…

@nikita-y
Copy link

Running tmux 3.1, in case that's an issue…

@kierun I'm running tmux 3.1 on macos catalina 10.15.4. I don't have the issue.

However I'm using a self-made weather plugin. Out of curiosity I switched to plugin by xamut and I immediately noticed some problems with the alignment.
self-made: image
by xamut: image

@kierun
Copy link
Author

kierun commented May 1, 2020

@nikita-y Yes, there is some weird alignment going on. When I maximise then minimise the window, I get a 1/2 character gap which is filled with black where the extra character was. Trying xamut's minus Nord does not show this problem.

Just if it matters: this happens on both Ubuntu and Fedora. It really should not matter…

@arcticicestudio
Copy link
Contributor

arcticicestudio commented May 4, 2020

Adding dedicated support for every plugin would mean that the bar will burst when there are more requests from other users. That's why this plugin only provides a minimal default content to prevent bloat.

Of course I'm very aware that users should be able to customize the content to fit their needs, but unfortunately the current implementation of the plugin doesn't allow to simply modify single elements but only disable the default content at all.

There are more open requests in this repository for other plugins and a way to design the content per user configurations, but I haven't got the time to refactor the plugin to allow this. I'd appreciate every PR and contribution to make this possible.

So for the weather plugin the only way is to customize the plugin sources on your own or disable the default content at all like described in the documentations I've linked above.
Sorry for not being able to provide this feature at the moment.

@kierun
Copy link
Author

kierun commented May 4, 2020

@arcticicestudio No worries whatsoever. Thank you for you work and explanations. Sadly, I am at the limits of my knowledge of tmux configuration so would not even know where to start to help even if I had the time. ☹ However, do let me know if you want anything tested in the future.

All the best and thank you for a super theme! ☺

@nicm
Copy link

nicm commented May 4, 2020

The problem seems like your terminal, font and/or libc disagreeing about the width of the Unicode codepoints you are using for the weather symbols. You could try rebuilding tmux with --enable-utf8proc.

@kierun
Copy link
Author

kierun commented May 4, 2020

@nicm I use st and that should support uft8… Of course, it is a trivially simple terminal which means it might not work.

I tried re-compiling tmux with --enable-utf8proc and get the same issue:

; ldd `which tmux`
        linux-vdso.so.1 (0x00007f85e1672000)
        libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f85e0f95000)
        libutf8proc.so.2 => /usr/lib/x86_64-linux-gnu/libutf8proc.so.2 (0x00007f85e0d4c000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f85e0b22000)
        libevent-2.1.so.6 => /usr/lib/x86_64-linux-gnu/libevent-2.1.so.6 (0x00007f85e08d1000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f85e06b6000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f85e02c5000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f85e00a6000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f85e144c000)

@nicm
Copy link

nicm commented May 4, 2020

It is not about general support for UTF-8 it is about the widths of the characters, if tmux and the terminal have different ideas about the width of characters that you use then the status line will not be aligned properly. Either it will be too long and wrap onto the following line, or it will be too short and there will be stray output at the end (like in your case).

Are you sure you restarted tmux entirely after rebuilding? tmux kill-server.

What is the actual character that is causing a problem?

@kierun
Copy link
Author

kierun commented May 4, 2020

@nicm

Are you sure you restarted tmux entirely after rebuilding? tmux kill-server.

Yes, I did.

What is the actual character that is causing a problem?

So far it seems to be any of the weather icons. @nikita-y seems not to have problems when they are not using them.

@nicm
Copy link

nicm commented May 4, 2020

Right, but I don't know what weather icons are, can you copy and paste one of them here?

@kierun
Copy link
Author

kierun commented May 4, 2020

Right, but I don't know what weather icons are, can you copy and paste one of them here?

Ah, I see. Here are some examples:

; curl -s 'wttr.in/{Paris,london,moscow,tokyo}?format=3'
Paris:⛅ +17°C
london: ☀ +15°C
moscow: 🌩 +24°C
tokyo:⛅ +19°C

And how it looks on my terminal:

Untitled

@nicm
Copy link

nicm commented May 4, 2020

I see the same problem on OS X, libc doesn't know the width of this symbol so tmux assumes it is width 1. If you run for example tmux -Ltest -f/dev/null -vv new then do:

printf '⛅\n'
exit

Do you see this in the log?

$ grep Unicode tmux-server*.log
1588597364.430575 Unicode 26c5, wcwidth() -1

If I build with libutf8proc then tmux gets the correct width 2.

What version of utf8proc do you have? I have 2.5.0.

@nicm
Copy link

nicm commented May 4, 2020

I think you will have trouble actually if st is also using wcwidth(), so you may need to use a different terminal.

@kierun
Copy link
Author

kierun commented May 4, 2020

Do you see this in the log?

Sadly, I see nothing in the logs.

What version of utf8proc do you have? I have 2.5.0.

I have 2.1.0-1 which is the default Ubuntu one.

I think you will have trouble actually if st is also using wcwidth(), so you may need to use a different terminal.

St does use that. Using gnome-terminal, I do not get the problem.

@nicm
Copy link

nicm commented May 4, 2020

If you look for top_bit you will see the width tmux is using:

$ grep top_bit tmux-server-*.log
1588599649.505904 input_top_bit_set 3 '\342\233\205' (width 2)

If tmux is using width 2 (with or without utf8proc), and it works in gnome-terminal, then it sounds like an st problem and you would be best talking to them about it.

@kierun
Copy link
Author

kierun commented May 4, 2020

Ah, it does look like a st problem then:

; grep top_bit tmux-server-*.log
13206:1588599861.114720 input_top_bit_set 3 '\342\233\205' (width 2)
13426:1588599861.851887 input_top_bit_set 3 '\342\233\205' (width 2)
13855:1588599862.339703 input_top_bit_set 3 '\342\233\205' (width 2)

I shall open a bug (if I can figure out how) with them and link to this issue…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants