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

Built-in terminal / 内建终端 #548

Open
CyanoHao opened this issue Dec 20, 2024 · 0 comments
Open

Built-in terminal / 内建终端 #548

CyanoHao opened this issue Dec 20, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@CyanoHao
Copy link
Contributor

Problem / 问题

Various Unix terminal accept different argument patterns, for example to run the command bash -c "echo hello; sleep 3":

各种 Unix 终端接受不同的参数模式,以执行 bash -c "echo hello; sleep 3" 命令为例:

# xterm compatible
konsole -e bash -c "echo hello; sleep 3"

# vte-based uses `-x` instead of `-e`, or gnu-style `--`
xfce4-terminal -x bash -c "echo hello; sleep 3"
gnome-terminal -- bash -c "echo hello; sleep 3"

# and some terminals do not pass argv as-is, they accept a command line
# and even worse, they accept argv, and compose them into a command line (WTF?)
kermit -e "bash -c \"echo hello; sleep 3\""

# the most terrible thing is that some terminals require a file containing the command
weston-terminal --shell /tmp/cmdfile-generated-by-redpanda-XXXXXX.sh
/System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal /a/very/long/temporary/directory/cmdfile-generated-by-redpanda-XXXXXX.command

Besides, many terminals default to use dbus to share same process among windows, making it hard to manage the lifecycle of user program. Luckily, most terminals provide argument to disable this feature, for example:

此外,许多终端默认使用 dbus 在窗口之间共享相同进程,这使得管理用户程序的生命周期变得困难。幸运的是,大多数终端提供了禁用此功能的参数,例如:

gnome-terminal --wait -- bash -c "echo hello; sleep 3"
terminator --no-dbus -x bash -c "echo hello; sleep 3"
lxterminal --no-remote -e bash -c "echo hello; sleep 3"

# but some terminal requires app-id trick
kgx --gapplication-app-id io.redpanda.PID.SEQ_ID -- bash -c "echo hello; sleep 3"

Red Panda C++ provided flexible "terminal arguments pattern" to support as many cases as possible. However, flexibility means complexity, and it is hard for a user to configure it correctly. So we provide a lookup list.

小熊猫C++ 提供了灵活的 “终端参数模式” 以支持尽可能多的情况。然而,灵活性意味着复杂性,用户很难正确配置它。因此我们提供了一个查找表

The arguments modifier is really tricky, and the lookup list is really hard to maintain.

在程序中进行参数修饰非常 tricky,查找表维护起来真的很难。

Solution / 解决方案

Implement built-in terminal window / panel based on QTermWidget.

基于 QTermWidget 实现内建终端窗口/面板。

Details: / 详情:

  1. Windows support: currently not. Probably we can implement sometime in the future with ConPTY.

    Windows 支持:目前不会。也许我们可以在将来使用 ConPTY 实现它。

  2. Use QTermWidget 2 + Qt 6; keep sync with upstream.

    使用 QTermWidget 2 + Qt 6;与上游保持同步。

  3. Remove Qt 5 support from Red Panda C++ on Unix host.

    小熊猫C++ 在 Unix host 上不再支持 Qt 5。

    • Linux rolling: build with system Qt 6.

      Linux 滚动发行版:使用系统 Qt 6 构建。

    • Linux fixed release: repack AppImage (what Ubuntu 20.04 does).

      Linux 固定发行版:重新打包 AppImage(就像现在 Ubuntu 20.04 那样)。

  4. External terminal support: keep it, but remove arguments pattern.

    外部终端支持:保留,但移除参数模式。

    • New options: target program argument separator (-e, -x or --), argument for running in separate process (-wait, etc., app-id trick will be removed).

      新选项:目标程序参数分隔符(-e-x--)、在单独进程中运行的参数(-wait 等,移除 app-id trick)。

    • New options are easy to configure. No lookup list needed.

      新选项易于配置。不需要查找表。

@royqh1979 royqh1979 added the enhancement New feature or request label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants