简体   繁体   English

在不进入 X-Window 的虚拟桌面的情况下从不同的虚拟桌面控制 X-Window?

[英]Controlling an X-Window from a different virtual desktop without entering that X-Window's virtual desktop?

I'm using the XFCE4 desktop environment under Ubuntu 20.0.4 .我在Ubuntu 20.0.4下使用XFCE4桌面环境。

I have several virtual desktops set up, each of which containing one or more applications which are running.我设置了几个虚拟桌面,每个虚拟桌面都包含一个或多个正在运行的应用程序。

Is there any way I can run an X-Windows-based command from one desktop and have it manipulate a window in a different desktop, without switching desktops?有什么方法可以从一个桌面运行基于 X-Windows 的命令,并让它在另一个桌面上操作 window,而无需切换桌面?

For example, suppose I have an xterm shell window running in virtual desktop 0, and that I currently am focused in virtual desktop 0.例如,假设我有一个 xterm shell window 在虚拟桌面 0 中运行,并且我目前专注于虚拟桌面 0。

And suppose I have a text editor window open in virtual desktop 1.假设我在虚拟桌面 1 中打开了一个文本编辑器 window。

Is there any way for me to remain focused in desktop 0 and to run a command within the xterm shell window which will send text to the text editor window in desktop 1?有什么方法可以让我保持专注于桌面 0 并在 xterm shell window 中运行命令,该命令会将文本发送到桌面 1 中的文本编辑器 window?

I don't want to see desktops shifting back and forth between desktop 0 and desktop 1 while this text is being sent to the text editor.在将此文本发送到文本编辑器时,我不想看到桌面在桌面 0 和桌面 1 之间来回移动。 I want to remain focused in desktop 0 for the entire duration of the running of this command.我想在运行此命令的整个过程中始终专注于桌面 0。

I know I can use xdotool to send text to another X window, but xdotool only seems to function when the destination window is in the same virtual desktop which currently has the focus.我知道我可以使用xdotool将文本发送到另一个 X window,但是当目标 window 位于当前具有焦点的同一个虚拟桌面时, xdotool似乎只有 function。 For example, I can do the following with xdotool , but it won't work unless the destination window (referred to by $windowid in the following example) is in my currently viewed virtual desktop:例如,我可以使用xdotool执行以下操作,但除非目标 window(在以下示例中由 $windowid 引用)在我当前查看的虚拟桌面中,否则它不会工作:

xdotool type --window $windowid Sample text

What I want is to send text and mouse clicks to windows in desktops that differ from the desktop that I'm currently viewing, and have the windows in those other desktops receive and respond to the text and mouse clicks without any switch to the other desktops taking place.我想要的是将文本和鼠标点击发送到与我当前正在查看的桌面不同的桌面中的 windows,并让其他桌面中的 windows 接收并响应文本和鼠标点击,而无需切换到其他桌面发生。

If necessary, I'm willing to write a program in C, C++, or pretty much any other language in order to implement this functionality.如有必要,我愿意用 C、C++ 或几乎任何其他语言编写程序来实现此功能。

But I'm wondering: is what I'm trying to do even possible in an X Windows environment?但我想知道:在 X Windows 环境中,我正在尝试做的事情是否可行?

Thank you very much in advance for any thoughts and suggestions.非常感谢您的任何想法和建议。

Virtual Desktops : 虚拟桌面

Most X servers have only a single screen.大多数 X 服务器只有一个屏幕。 The window manager may virtualize this resource and offer multiple so-called 'virtual desktops', of which only one can be shown on the screen at a time. window 管理员可以虚拟化此资源并提供多个所谓的“虚拟桌面”,一次只能在屏幕上显示一个。 There is some variation among the features of virtual desktop implementations.虚拟桌面实现的功能之间存在一些差异。 There may be a fixed number of desktops, or new ones may be created dynamically.可能有固定数量的桌面,也可能会动态创建新的桌面。 The size of the desktops may be fixed or variable.桌面的大小可以是固定的或可变的。

Implementation note实施说明

There are at least two options for implementing virtual desktops.至少有两种实施虚拟桌面的选择。 The first is to use multiple virtual roots and change the current desktop by manipulating the stacking order of the virtual roots.第一种是使用多个虚拟根并通过操纵虚拟根的堆叠顺序来更改当前桌面。

The second option is to keep all managed windows as children of the root window and unmap the frames of those which are not on the current desktop.第二个选项是将所有托管的 windows 保留为根 window 的子项,并取消映射那些不在当前桌面上的框架。

In any case, you should study the Extended Window Manager Hints .在任何情况下,您都应该学习扩展的 Window 管理器提示
These properties might be of interest to you:您可能对这些属性感兴趣:

Root Window Properties : 根 Window 属性

Application Window Properties : 应用程序 Window 属性


Xlib :

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

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