joouha / euporie

Jupyter notebooks in the terminal
https://euporie.readthedocs.io
MIT License
1.54k stars 36 forks source link

Euporie does not work in Alacritty (without Tmux?) #18

Closed Peder2911 closed 2 years ago

Peder2911 commented 2 years ago

Hello again!

I am having a really weird issue, where Euporie doesn't output anything if launched from Alacritty, but works fine in gnome-terminal. Also, works fine if run from Tmux within alacritty?

When i run Euporie from "vanilla" Alacritty, there's no output. If i press Ctrl-C, the output is:

Traceback (most recent call last):
  File "/home/peder/.local/bin/euporie", line 8, in <module>
    sys.exit(App.launch())
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/__init__.py", line 137, in launch
    app = cls()
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/__init__.py", line 71, in __init__
    self.configure()
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/__init__.py", line 113, in configure
    super().__init__(
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 314, in __init__
    self._merged_style = self._create_merged_style(include_default_pygments_style)
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/__init__.py", line 186, in _create_merged_style
    if self.bg_color:
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/term.py", line 181, in bg_color
    if result := _query_term(
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/term.py", line 132, in _query_term
    output += stdin.read(1)
KeyboardInterrupt

Tmux is an OK workaround for me, just thought I'd let you know.

euporie==0.1.16 alacritty==0.4.1

joouha commented 2 years ago

Hello,

I think you're seeing this because alacritty did not implement support for secondary device attributes until version 0.6.0, which euporie uses to check which features the terminal supports (e.g. sixel images, etc.).

You can check for secondary device attribute support by running: python -c "print('\x1b[>0c')". If your terminal responds to the control sequence, it will insert a string at the next prompt.

If you update to alacritty >=0.6.0, euporie should work.

Euporie works for me with alacritty==0.8.0 on Linux.

Interestingly, I get the exact same issue with alacritty==0.9.0 on Windows, where it does not seem to respond to secondary device attribute requests. I'm not sure if this is intentional or a bug in alacritty.


Euporie should be able to work on terminals without secondary device attribute support: I need to add a timeout such that loading continues if no response from the terminal is received when requesting secondary device attributes.

joouha commented 2 years ago

I've added a timeout to the terminal feature detection, so euporie should now work in old versions of alacritty

This should be fixed in v1.0.0

Peder2911 commented 2 years ago

Great work! Thanks.