Open iSeiryu opened 11 months ago
This is certainly an ambitious feature.
Implementing from scratch is not really feasible, so there would need to be a library which did all the heavy lifting (web page -> ascii, scroll, request link etc). So probably a library wrapping chromium or something. Any library/binary that is directly writing to screen e.g. with curses is going to be harder to wrap.
This would make more sense as a seperate library:
The other way to deal with this would be to have your main app exit from the Terminal.Gui main loop and run a web browser (e.g. lynx) full screen in the terminal. Then on exit re-launch the terminal gui. But that would not allow you to embed
If you want to have an idea on how to do this here is a Blazor API done for the Terminal.Gui v1
. For Terminal.Gui v2
this will not be possible anymore because the ConsoleDriver
and others API's isn't exposed anymore. So as @tznind said avoids any big dependencies to Terminal.Gui
. Another solution is add a new project integrated with on the gui.cs and ask to tig if it's possible to do it. Good luck.
If you want to have an idea on how to do this here is a Blazor API done for the
Terminal.Gui v1
. ForTerminal.Gui v2
this will not be possible anymore because theConsoleDriver
and others API's isn't exposed anymore. So as @tznind said avoids any big dependencies toTerminal.Gui
. Another solution is add a new project integrated with on the gui.cs and ask to tig if it's possible to do it. Good luck.
@bdisp the OP is not asking for Terminal.Gui apps in a browser. He/she is asking for a web browser within a Terminal.Gui app.
@BDisp the OP is not asking for Terminal.Gui apps in a browser. He/she is asking for a web browser within a Terminal.Gui app.
Ops my bad, sorry for the misunderstand.
This is certainly an ambitious feature.
Implementing from scratch is not really feasible, so there would need to be a library which did all the heavy lifting (web page -> ascii, scroll, request link etc). So probably a library wrapping chromium or something. Any library/binary that is directly writing to screen e.g. with curses is going to be harder to wrap.
This would make more sense as a seperate library:
- Avoids adding any big dependencies to Terminal.Gui
- Isolates issues relating to web behaviours
- Provides dedicated channel for the work
The other way to deal with this would be to have your main app exit from the Terminal.Gui main loop and run a web browser (e.g. lynx) full screen in the terminal. Then on exit re-launch the terminal gui. But that would not allow you to embed
I have experience with .NET Html engines as part of https://github.com/tig/winprint.
I use LiteHtml
to be able to print HTML files. See https://github.com/tig/winprint/tree/master/src/WinPrint.LiteHtml
99% of the cases users of WinPrint choose fixed-pitch fonts, and thus it would not be THAT hard to use LiteHtml to be able to render to a Terminal.Gui View
.
@tig just curious were those strings supposed to look like this or someone forgot to update them? https://github.com/tig/winprint/blob/master/src/WinPrint.LiteHtml/LibInterop.cs#L47
The rendered pages don't have to look fancy, just get a general idea of what a page looks like and to be able to read text. But rendering a single page is just a part of the problem. Being able to navigate between pages by clicking links is the bare minimum for the internet surfing.
Maybe the engine that https://github.com/fathyb/carbonyl uses could be an option? It seems very light-weight.
@tig just curious were those strings supposed to look like this or someone forgot to update them? https://github.com/tig/winprint/blob/master/src/WinPrint.LiteHtml/LibInterop.cs#L47
Sorry, don't remember.
The rendered pages don't have to look fancy, just get a general idea of what a page looks like and to be able to read text. But rendering a single page is just a part of the problem. Being able to navigate between pages by clicking links is the bare minimum for the internet surfing.
Maybe the engine that https://github.com/fathyb/carbonyl uses could be an option? It seems very light-weight.
Wow. That's cool.
It's not clear to me if this is a PORT of Chromium or somehow uses Chromium??
According to this carbonyl uses a modified version of the chromium headless shell
According to this carbonyl uses a modified version of the chromium headless shell
Thinking about this more, I'm skeptical a Chromium-based solution will work well for many Terminal.Gui scenarios:
Microsoft.PowerShell.ConsoleGuiTools
wanted to use WebView
in some way. No way, would it be acceptable that Install-Module Microsoft.PowerShell.ConsoleGuiTools
install and configure Chromium.I'm back to the idea that WebView
should be based on pure .NET based HTML engine like LiteHtml
.
I wonder how feasible it would be to have a view that wrapped another console process (kind of like tmux). This would allow running w3c
or lynx
in a view as well as solving another asked for feature which is to run a full console surrounded by terminal gui components.
I know there has been work in the past on TerminalView e.g. https://github.com/migueldeicaza/XtermSharp/blob/master/GuiCsHost/TerminalView.cs which might allow something like this (see https://github.com/gui-cs/Terminal.Gui/discussions/1244#discussioncomment-671113).
Is your feature request related to a problem? Please describe. View websites or render HTML strings inside a terminal. There are lots of potential uses for this feature. I'm not sure if it's even possible with the current state of dotnet without writing a whole new HTML rendering engine.
Describe the solution you'd like Either incorporate one of the existing WebView controls, e.g. https://www.nuget.org/packages/Microsoft.AspNetCore.Components.WebView/ or create a new one based on some existing engine.
Additional context Existing CLI based web browers: https://github.com/fathyb/carbonyl http://lynx.browser.org/ https://github.com/tats/w3m/tree/master/doc