fishline icon indicating copy to clipboard operation
fishline copied to clipboard

TTY theme is used in flatpak terminals

Open MattSturgeon opened this issue 3 years ago • 2 comments

Hi, I couldn't find this documented anywhere, so I'm not sure if this is a bug in fishline, the respective terminals or simply something that could be documented better.

Most terminals look like this (gnome-terminal):

image

But a few look like this (BlackBox):

Screenshot from 2022-07-10 22-47-01

The gnome-builder integrated terminal is also affected:

image

One correlation is that the working terminals seem to be installed normally, while (so-far) the affected terminals are installed as flatpaks. ~~I believe I also noticed similar behaviour on windows (msys2 and wsl2), but will need to double check next time I'm on a windows machine.~~ So perhaps there's something weird going on in flatpak ~~and windows~~ environments?

Does fishline do any checks to decide if it'll render [ ] instead of arrows?

MattSturgeon avatar Jul 10 '22 22:07 MattSturgeon

Hello @MattSturgeon, this seems to be some kind of undefined behaviour in those untested environments. Fishline tries to detect if it is running under a tty (see https://github.com/0rax/fishline/blob/master/conf.d/fishline-init.fish#L15-L25) and load the fallback theme (the one without arrows) there as power-line glyphs are usually not available in this context.

You can check if this is the case by running tty | grep tty if something is shown here, the tty compatible symbols will be loaded.

You should be able to force the default glyphs to be used manually by adding the following line after fishline is initialized:

source $PATH_TO_FISHLINE/conf.d/fishline-themes/default_symbols.fish

Depending on how you installed it, this can be done by adding to your configuration:

if status is-interactive
    set FLINE_PATH $HOME/.config/fish/fishline
    source $FLINE_PATH/init.fish
	source $FLINE_PATH/conf.d/fishline-themes/default_symbols.fish
end

If you have installed it using fisher, creating a fishline-theme.fish file with the following line should work:

source ~/.config/fish/conf.d/fishline-themes/default_symbols.fish

Let me know if you can confirm that tty | grep tty does indeed return something and/or if any of my proposed fixes works. I will try to replicate the issue in a VM on my end and update my TTY detection routine though I might just remove it and let the user add it themselves if they want it / document it properly.

Hope this helps

0rax avatar Jul 10 '22 23:07 0rax

I believe I also noticed similar behaviour on windows (msys2 and wsl2), but will need to double check next time I'm on a windows machine.

Looks like I mis-remembered this part. Checked on windows and it appears unaffected. At least in Windows Terminal.

You can check if this is the case by running tty | grep tty if something is shown here, the tty compatible symbols will be loaded.

The two flatpak terminals print not a tty (and exit 1, but grep changes exit code to 0)

image

EDIT: ~~didn't check, but tty is probably printing not a tty to stderr, so might also help to only capture stdout.~~ nope, prints to stdout

Perhaps run ttty, check its exit code and then grep its stdout?

If you have installed it using fisher, creating a fishline-theme.fish file with the following line should work:

source ~/.config/fish/conf.d/fishline-themes/default_symbols.fish

image

This works... Thanks! Although the colouring is different - guessing that's a theming issue rather than an environment/fishline issue? :thinking: EDIT: looks like maybe an issue with sourcing stuff in the wrong order? Doesn't occur with my PR.

Hope this helps

Definitely, thanks

MattSturgeon avatar Jul 12 '22 04:07 MattSturgeon