IonicaBizau / web-term

:tv: A fullscreen terminal in your browser.
MIT License
168 stars 21 forks source link

Feature idea - web widgets #46

Closed nemanjan00 closed 4 years ago

nemanjan00 commented 8 years ago

It would be really cool to be able to create API which console apps can somehow call and manipulate DOM of page where web-term is.

For example, imagine if you could use vim inside web-term and you are able to add iframe next to terminal for live markdown preview...

IonicaBizau commented 8 years ago

@nemanjan00 Ha! That would be cool! :sparkles:

I'm not sure about the implementation, tho. In the terminal we only write to the streams so we don't really work with the entire file buffer when working in VIM.

What other similar ideas do you have? I'm trying to think what would be the best way to do that.

nemanjan00 commented 8 years ago

Maybe there can be REST API so CLI apps can call it?

For example, Vim plugin can listen on some port and send json request to REST API to add iframe to web-term.

Something like grid would be cool. Also, it would be cool to have something like ability to create workspaces so, when you switch tmux window, it changes...

There are tools like nyaovim, but this would be way cooler since only browser which is aniway most of the time on would take RAM.

IonicaBizau commented 8 years ago

@nemanjan00 This is definitely a brainstorm. :grin:

Could you add an example of high-level configuration that would integrate what you want and give flexibility to the programmers to build their own configs?

I guess instead of REST API we can have web socket configuration which is already there.

nemanjan00 commented 8 years ago

I am just now creating blueprint. This would be great for creating IDE like features with icons for calling Vim functions and similar.

https://gist.github.com/nemanjan00/7faa1f0aae96e8c891dc

I do not think using websockets is good idea since it is hard to develop clients for then in some languages.

nemanjan00 commented 8 years ago

I think we should colaborate on editing this file and create something flexible.

In my case there is no need for anything but horizontal stack of iframes but I considered some people may need something else also.

For my personal use I would write plugins for realtime markdown, image editing, realtime ionic, etc.

nemanjan00 commented 8 years ago

Also, file manager....

IonicaBizau commented 8 years ago

@nemanjan00 Interesting! :dizzy: What kind of APIs would you need (how should the input look like and the output)? I guess the whole point is to support web-term plugins that will work on client and/or server.

nemanjan00 commented 8 years ago

Something like this

GET /workspace/1/stack - List iframes in stack POST /workspace/1/stack/markdown-preview - Create iframe in stack PUT /workspace/1/stack/markdown-preview - Edit iframe with id markdown-preview DELETE /workspace/1/stack/markdown-preview - Delete iframe with id markdown-preview

GET /workspace/1/buttons POST /workspace/1/buttons/run PUT /workspace/1/buttons/run DELETE /workspace/buttons/run

GET /workspace/1/tabs POST /workspace/1/tabs/log PUT /workspace/1/stack/log DELETE /workspace/1/log

GET /workspace/1/context GET /workspace/1/context/file POST /workspace/1/context/file/custom-open PUT /workspace/1/context/file/custom-open DELETE /workspace/1/context/file/custom-open

Also, argument for all of them can be pid, so, when that pid is terminated, iframe should be removed

IonicaBizau commented 4 years ago

I will close this as we can keep this one simple and for widgets we can use apps like tmux.