简体   繁体   English

生成的终端出现在不同的桌面上

[英]Spawned terminal appears on different desktop

I have a python script which starts a new instance in a new terminal window every minute using xterm (see below). 我有一个python脚本,它每分钟使用xterm在新的终端窗口中启动一个新实例(请参见下文)。 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. 我正在使用具有多个桌面(?)的Java桌面运行solaris,如果在其他桌面上工作,则当我希望新终端出现在最初运行脚本的桌面上时,就会出现新终端。 I am sure the answer would be an xterm command but can't find it anywhere! 我确定答案将是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'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. 我在跟踪指向更好解释的链接时遇到了麻烦,但是据我了解,当“命令”启动一个新窗口时,X协议并不能使窗口管理器轻松确定哪个桌面应该获得一个新窗口。从窗口管理器外部。

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.) (运行xprop(1) ,单击一个客户端,以查看一些可用的窗口管理器提示。)

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. 如果您的窗口管理器使轻松匹配具有不同属性的新客户端窗口并将其移动到所需位置变得容易,那么如果-e窗口名称不是,则可以使用xterm(1)-class命令行选项覆盖资源类。足以满足您的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM