在Gnome或KDE中以编程方式移动桌面上的应用程序窗口
Move application windows on desktop programmatically in Gnome or KDE
我想使用c++程序重新定位桌面上的应用程序窗口。我该怎么做,我需要两种情况的解决方案。
-
当我有了要移动的应用程序的源时。
-
通过编写外部程序移动其他应用程序的窗口。
外部Bash脚本:
xdotool search --onlyvisible --class dolphin windowmove 13 37
# ^ ^ ^
# window class X & Y coordinates
有关此方面的详细信息,请使用xdotool search
、xdotool windowmove
和man xdotool
。
C++示例:
#include <cstdlib>
#include <string>
#include <sstream>
using namespace std;
int main()
{
string cls="dolphin";
int x=13, y=37;
stringstream s;
s<<"xdotool search --onlyvisible --class "<<cls<<" windowmove "<<x<<" "<<y;
system(s.str().c_str());
return 0;
}
最简单的例子:
#include <stdlib.h>
int main()
{
system("xdotool search --onlyvisible --class dolphin windowmove 13 37");
return 0;
}
相关文章:
- 将对象移动到std::shared_ptr
- 何时在引用或唯一指针上使用移动语义
- 试图在visual studio上用C++创建一个桌面应用程序
- 如何从具有移动语义的类对象中生成共享指针
- 将shared_ptr移动到<StructA>shared_ptr<变体<结构A、结构 B>>
- C / C++ 移位/偏移/向左或向右移动位图?
- MSVC将仅移动结构参数解释为指针
- 自定义先决条件对移动分配运算符有效吗
- 返回值优化:显式移动还是隐式
- 当有分配器意识的容器被复制/移动时,反弹分配器是否被复制/移走
- 为什么复制而不是移动数据元素?
- 可以使用移动语义更改或改进此C++代码吗?
- 使lambda不可复制/不可移动
- c++在使用指针时移动语义
- 在跨平台桌面/移动应用程序套件中使用 ZeroMQ 来解决架构问题
- OpenGL-在倾斜的桌面上移动球
- 适用于桌面和移动应用程序的Qt
- DXGI 桌面复制 API 何时将区域标识为移动区域
- 在Gnome或KDE中以编程方式移动桌面上的应用程序窗口
- 是否可以创建一个可以在ios移动平台和windows桌面平台之间运行的应用程序,而无需使用web界面