简体   繁体   中英

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.

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.

  1. You should save your active window's ID to temporary file:

    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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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