简体   繁体   English

wmctrl打开没有焦点的窗口

[英]wmctrl to open window without focus

I am using the command: 我正在使用命令:

wmctrl -a **id of application** -i

This is very close to what I am looking for, however Is there a away I can use wmctrl without bringing focus to the application. 这与我要寻找的非常接近,但是我可以使用wmctrl而不用专注于应用程序吗?

For example if i run the command to bring up a window on my 2nd screen in terminal the focus of the mouse and keyboard stay on terminal. 例如,如果我运行命令在终端的第二个屏幕上弹出一个窗口,则鼠标和键盘的焦点将停留在终端上。

xdotool may come in handy in your situation. xdotool可能会在您遇到的情况中派上用场。

  1. You should save your active window's ID to temporary file: 您应该活动窗口的ID 保存到临时文件中:

    xdotool getactivewindow > ~/.window_id

  2. Then focus desired window: 然后聚焦所需的窗口:

    wmctrl -a **id of application** -i

  3. And then restore focus to the previous window: 然后焦点恢复到上一个窗口:

    xdotool windowfocus $(cat ~/.window_id) xdotool windowactivate $(cat ~/.window_id)

Using xbindkeys , xdotool and wmctrl combined create a very powerful tool-set. 结合使用xbindkeysxdotoolwmctrl创建非常强大的工具集。

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

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