如何让 cygwin .xinitrc 等待 X 服务器退出?

发布于 2024-08-14 21:22:16 字数 891 浏览 2 评论 0原文

我正在使用 Cygwin 的 startx,并且想要自定义我的 xinitrc,这样我就不会在屏幕上看到任何“神奇”的 X 程序,即,如果我退出它们,这些程序将导致 X 服务器终止。实际上,我根本不希望任何 X 程序在屏幕上启动;我只想使用从我的 .XWinrc 自定义的 XWin 菜单。

通常,在 .xinitrc 中,我会让最后一行运行窗口管理器。然后我可以通过从窗口管理器自己提供的界面退出来退出 X。

在这种情况下,虽然我的窗口管理器和我的服务器实际上是相同的进程,因为我使用的是 XWin 服务器。我没有要执行的窗口管理器。我从 .xserverrc 文件启动服务器:

exec XWin -multiwindow -clipboard -silent-dup-error

我可以在 .xinitrc 末尾循环睡眠:

while [ 1 -eq 1 ]
do
  sleep 10
done

但这似乎不太优雅。

我可以等待子进程,可以通过将其作为 .xinitrc 中的最后一行启动,或者通过在后台较早启动它并使用“wait {PID}”显式等待它。但我等不及XWin.exe进程了,因为它是我的.xinitrc脚本的父进程,而不是子进程。

我无法在 .xinitrc 末尾启动 XWin.exe;如果我尝试,我会得到一个不同的窗口管理器,显然会启动,而 XWin 不处于无根模式,然后我会立即关闭。

有没有比循环睡眠更优雅的方法呢?有没有办法从我的 .xinitrc 启动 XWin 并等待它?有没有办法告诉 .xinitrc shell 脚本只是等待而不退出,而不休眠,这样它将继续执行并且什么也不做,直到 XWin.exe 退出?我是否应该在后台启动一些东西作为 .xinitrc 的最后一行,以便给我一个等待进程而不启动 X 程序?

I'm using Cygwin's startx and want to customize my xinitrc so that I don't get any "magic" X programs on screen, i.e., programs that will cause the X server to terminate if I exit them. I don't want any X programs to start up on screen at all, actually; I just want to use the XWin menu, customized from my .XWinrc .

Ordinarily from a .xinitrc, I would make the last line run the window manager. Then I can exit X by exiting the window manager from its own provided interface.

In this case, though my window manager and my server are effectively the same process, because I am using the XWin server. I don't have a windows manager to execute. I am starting the server from my .xserverrc file:

exec XWin -multiwindow -clipboard -silent-dup-error

I can sleep at the end of my .xinitrc, in a loop:

while [ 1 -eq 1 ]
do
  sleep 10
done

But that seems inelegant.

I can wait for a child process, either by starting it up as the last line in my .xinitrc, or by starting it up earlier in the background and waiting for it explicitly with "wait {PID}". But I can't wait for the XWin.exe process, because it is a parent process of my .xinitrc script, not a child process.

I can't start up XWin.exe at the end of .xinitrc; if I try, I get a different window manager apparently starting up, with XWin not in rootless mode, and then I get an immediate shutdown.

Is there a more elegant way to do this than sleeping in a loop? Is there a way to start XWin from my .xinitrc and wait on it? Is there a way to tell the .xinitrc shell script to simply wait and not exit, without sleeping, such that it will continue executing and do nothing until XWin.exe exits? Is there something I should be starting in the background as the last line of my .xinitrc, so as to give me a process to wait on without starting up an X program?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丑丑阿 2024-08-21 21:22:16

因此,总结一下 Ben Bullock 的回答,即“如何让 .xinitrc 执行此操作?”的答案。是“不要!”永远不要问“我如何使用 X 来做 Y?”问题。 :) 完全跳过 startx/.xinitrc 。

So, summarizing from Ben Bullock's answer, the answer to "How do I make .xinitrc do this?" is "Don't!" Never ask "How do I use X to do Y?" questions. :) Skip startx/.xinitrc entirely.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文