Author Topic: cbTerminal plugin to access terminal from the bottom panel for Linux ( wxGtk )  (Read 4875 times)

Offline christo

  • Multiple posting newcomer
  • *
  • Posts: 39
https://github.com/josephch/cbTerminal is a small plugin to show bash terminal using VTE Gtk widget. It might be useful for Linux users.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6063
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Nice work.

My question is that can you bring such feature to Windows OS?

Thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline christo

  • Multiple posting newcomer
  • *
  • Posts: 39
Nice work.

My question is that can you bring such feature to Windows OS?

Thanks.

@ollydbg, I've tried TerminalWx, which I believe is cross-platform. I decided to go with VTE because it appears better in my Ubuntu. My work to integrate TerminalWx is available in https://github.com/josephch/cb-TerminalWx . For Windows, you can try changing cbTerminalView_TerminalWx.cpp to use the correct terminal.
Edit : Following link describes a psuedoterminal i think that can be used for windows https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
« Last Edit: January 01, 2025, 05:58:02 am by christo »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6063
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Hi, sorry for the late reply, I'm busy these days.

I have made a new fork of your repo: asmwarrior/TerminalWx: WxWidgets Terminal Widget, and try to build this library with the C::B and msys2.

I see some link errors

Code
[100.0%] g++.exe  -o bin\Debug\TestApp.exe obj\Debug\src\GTerm\actions.o obj\Debug\src\GTerm\gterm.o obj\Debug\src\GTerm\keytrans.o obj\Debug\src\GTerm\states.o obj\Debug\src\GTerm\utils.o obj\Debug\src\GTerm\vt52_states.o obj\Debug\src\taTelnet\wxterm.o obj\Debug\src\terminalinputevent.o obj\Debug\src\terminalwx.o obj\Debug\TestApp.o obj\Debug\TestMain.o  -LF:/code/msys2-64/mingw64/lib -pipe -lwx_mswu_xrc-3.2 -lwx_mswu_webview-3.2 -lwx_mswu_html-3.2 -lwx_mswu_qa-3.2 -lwx_mswu_adv-3.2 -lwx_mswu_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2    -mwindows
F:/code/msys2-64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: obj\Debug\src\terminalwx.o: in function `__static_initialization_and_destruction_0':
F:\code\TerminalWx/src/terminalwx.cpp:76:(.text+0x518): undefined reference to `__imp_chEVT_TERMINAL_INPUT'
F:/code/msys2-64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: F:\code\TerminalWx/src/terminalwx.cpp:78:(.text+0x52a): undefined reference to `__imp_chEVT_TERMINAL_INPUT'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 8 second(s))
3 error(s), 101 warning(s) (0 minute(s), 8 second(s))

see the attachment txt log file for more details.


EDIT:

Quote
Edit : Following link describes a psuedoterminal i think that can be used for windows https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/

I'm not sure how difficult the windows conpty API is. I haven't tried it yet.


« Last Edit: January 24, 2025, 09:02:53 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6063
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
OK, the linker error issue is fixed, I have pushed to my git fork.

Now, when I run the program, I see below screen shot, but I can't enter any chars to the terminal window.



If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline christo

  • Multiple posting newcomer
  • *
  • Posts: 39
@ollydbg, by default nothing will be shown. You have to integrate a pseudo terminal, then only the widget will be useful. Also please refer https://github.com/josephch/cb-TerminalWx/blob/dfad6bd1922b70af7f9d33f09fbd51bf7608710f/cbTerminalView_TerminalWx.cpp , you can see how data is read and written to the terminal emulator.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6063
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
I tried, and derived a new class named "TerminalWxWin", and it use the winpty library from msys2/mingw.

The final result is: some text is shown in the main frame, see below, but still far from usage, I can't enter any text, and the input text does not show fully.

See image shot below.

I have push my changes to my code repo: https://github.com/asmwarrior/TerminalWx

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline christo

  • Multiple posting newcomer
  • *
  • Posts: 39
@ollydbg, this is good progress. Could you please check my comment https://github.com/asmwarrior/TerminalWx/commit/3cd8578500ea91bc23b3c13f6e3865c9b87b42e4#r151768824 ?

Thanks, Christo

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6063
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
@ollydbg, this is good progress. Could you please check my comment https://github.com/asmwarrior/TerminalWx/commit/3cd8578500ea91bc23b3c13f6e3865c9b87b42e4#r151768824 ?

Thanks, Christo

Thanks, actually, that code is created by some AI, and I know little about how the terminal works.

I create an issue about the reading of the console text here with some of by debug result.

Windows console text does not show correctly  Issue #1 asmwarrior/TerminalWx
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.