生成的终端出现在不同的桌面上
我有一个 python 脚本,它使用 xterm 每分钟在新的终端窗口中启动一个新实例(见下文)。我正在使用具有多个桌面(?)的Java桌面运行solaris,如果在不同的桌面上工作,当我希望它出现在最初运行脚本的桌面上时,新终端就会出现。我确信答案是 xterm 命令,但在任何地方都找不到它!
import sys, os, subprocess, time
i = 1
args = ['xterm', '-e', 'python2.6', 'script.py']
x = int(sys.argv[1])
while i <= x:
subprocess.Popen(args)
i += 1
time.sleep(60)
I have a python script which starts a new instance in a new terminal window every minute using xterm (see below). I am running solaris with the Java desktop that has multiple desktops(?), if working on a different desktop the new terminal appears when I would like it to appear on the desktop where the script is intially run. I am sure the answer would be an xterm command but can't find it anywhere!
import sys, os, subprocess, time
i = 1
args = ['xterm', '-e', 'python2.6', 'script.py']
x = int(sys.argv[1])
while i <= x:
subprocess.Popen(args)
i += 1
time.sleep(60)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法找到更好解释的链接,但据我了解,X 协议并不能让窗口管理器轻松确定当启动新窗口的“命令”发出时哪个桌面应该获得新窗口从窗口管理器外部。
例如,您的窗口管理器可能提供一个工具栏,用于启动程序并知道它位于哪个桌面,然后可以告诉窗口管理器在呈现新客户端窗口时使用哪个桌面。但是,如果系统上的某些其他应用程序在不知道桌面并且不知道与窗口管理器通信的机制的情况下启动了一个窗口,那么它只会进入“活动”桌面。
某些窗口管理器允许您指定一些有关窗口类或名称的提示。 (运行
xprop(1)
,单击客户端,查看一些可用的窗口管理器提示。)例如:
如果您的窗口管理器可以轻松匹配新客户端具有不同属性的窗口并将它们移动到您想要的位置,然后您可以使用 xterm(1) 的
-class
命令行选项来覆盖资源类,如果-e
窗口名称不足以满足您的需要需要。I'm having trouble tracking down links to better explanations, but it is my understanding that the X protocol does not make it easy for a window manager to determine which desktop should get a new window when the "command" to start a new window originates from outside the window manager.
For example, your window manager may provide a toolbar that starts programs and knows which desktop it is on, and can then tell the window manager which desktop to use when the new client window is rendered. But if some other application on the system starts a window without knowing the desktop and without knowing a mechanism to communicate to the window manager which window to expect and which desktop to use, it'll just go onto the "active" desktop instead.
Some window managers allow you to specify some hints on window class or name. (Run
xprop(1)
, click on a client, to see some of the window manager hints available.)For example:
If your window manager makes it easy to match new client windows with different properties and move them where you wish, then you can use
xterm(1)
's-class
command line option to override the resource class if the-e
window name is not sufficient for your needs.