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

TTY theme is used in flatpak terminals #38

Open
MattSturgeon opened this issue Jul 10, 2022 · 2 comments · May be fixed by #39
Open

TTY theme is used in flatpak terminals #38

MattSturgeon opened this issue Jul 10, 2022 · 2 comments · May be fixed by #39

Comments

@MattSturgeon
Copy link

MattSturgeon commented Jul 10, 2022

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?

@0rax
Copy link
Owner

0rax commented Jul 10, 2022

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

@MattSturgeon
Copy link
Author

MattSturgeon commented Jul 12, 2022

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? 🤔 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 added a commit to MattSturgeon/fishline that referenced this issue Jul 16, 2022
When there is absolutely no tty set at all (e.g. in a shell spawned by
a flatpak), tty prints 'not a tty', which matches `tty | grep "tty"`.

Luckily `tty` also returns `1`, so we can do a two-stage check instead:

```fish
set --local out (tty)

and string match --quiet --entire "tty" $out
```

This fixes 0rax#38
MattSturgeon added a commit to MattSturgeon/fishline that referenced this issue Jul 16, 2022
When there is absolutely no tty set at all (e.g. in a shell spawned by
a flatpak), tty prints 'not a tty', which matches `tty | grep "tty"`.

Luckily `tty` also returns `1`, so we can do a two-stage check instead.

This fixes 0rax#38
@MattSturgeon MattSturgeon linked a pull request Jul 16, 2022 that will close this issue
MattSturgeon added a commit to MattSturgeon/fishline that referenced this issue Jul 16, 2022
When there is absolutely no tty set at all (e.g. in a shell spawned by
a flatpak), tty prints 'not a tty', which matches `tty | grep "tty"`.

Luckily `tty` also returns `1`, so we can do a two-stage check instead.

This fixes 0rax#38
@MattSturgeon MattSturgeon changed the title Powerline arrows don't show in some terminal apps TTY theme is used in flatpak terminals Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants