user-interface - 打开使用 Ncurses 的图形窗口
问题描述
假设我在一些图形 X Window 环境之上运行 xterm 或其他一些终端仿真器。例如,KDE 上的 xterm。我想编写一个可以在一个终端仿真器的命令行上调用的应用程序,在执行时,该应用程序创建一个新的KDE/Environment 窗口,与当前终端仿真器分开,并在该新窗口上运行 Ncurses 上下文应用目的。
我该怎么做?这个终端模拟器依赖吗?桌面环境依赖?我会使用裸 X 窗口系统调用吗?
解决方案
它依赖于终端(模拟器)。
诅咒在终端和终端仿真器中运行。后者(终端仿真器)中的大多数都有某种方式来告诉在终端仿真器中运行什么程序(除了你的 shell)。
例如,可以使用-e
选项告诉 xterm,
-e program [ arguments ... ]
This option specifies the program (and its command line
arguments) to be run in the xterm window. It also sets the
window title and icon name to be the basename of the program
being executed if neither -T nor -n are given on the command
line.
NOTE: This must be the last option on the command line.
让您像这样启动运行MyApplication的xterm:
xterm -e MyApplication
同样,您可能在 X 中运行的大多数终端仿真器都接受该选项。KDE konsole 就是这样做的。没有说明书,但是
konsole --help-all
最后显示它。
推荐阅读
- html - 进度条未垂直对齐
- curl - 在特定响应 URL 处卷曲 php 重定向
- google-bigquery - BigQuery 子查询
- javascript - 使用 React JS 和 WebSocket 实时更新价格
- wordpress - 让 WordPress 的默认帖子转到 /blog——永久链接不起作用
- javascript - Xamarin 表单制作简单菜单
- javascript - 删除一个 js 脚本
- svg - 在d3中拖动期间查找与父元素的偏移量
- tclientdataset - 使用 C++ Builder 6 和 C++ Builder 10.2 从网络共享写入/读取文件时出现问题
- c# - 允许将 id_token 而不是 Access Token 传递给 api