What about minimizing your window after creating it?
$ (mate-terminal --window-with-profile=Background --title=xxx --command top >/dev/null 2>&1 &); sleep 0.1; xdotool windowminimize $(xdotool search --name xxx|head -1)
I use Mate instead of Gnome but it should work just the same if you replace mate-terminal
with gnome-terminal
:
$ (gnome-terminal --window-with-profile=Background --title=xxx --command top >/dev/null 2>&1&); sleep 0.1; xdotool windowminimize $(xdotool search --name xxx|head -1)
First, i create new window with mate-terminal
and I assign name using --title=xxx
option. After that I use xdotool search --name xxx|head -1
to find id of this window and I pass it to xdotool windowminimize
. sleep 0.1
delay is necessary because window needs a little while to be created.
Instead of using window title you can also use other search options:
$ xdotool search Usage: xdotool search [options] regexp_pattern
--class check regexp_pattern agains the window class
--classname check regexp_pattern agains the window classname
--maxdepth N set search depth to N. Default is infinite.
-1 also means infinite.
--onlyvisible matches only windows currently visible
--pid PID only show windows belonging to specific process
Not supported by all X11 applications
--screen N only search a specific screen. Default is all screens
--desktop N only search a specific desktop number
--limit N break search after N results
--name check regexp_pattern agains the window name
--title DEPRECATED. Same as --name.
--all Require all conditions match a window. Default is --any
--any Windows matching any condition will be reported
--sync Wait until a search result is found.
-h, --help show this help output
If none of --name, --classname, or --class are specified, the defaults are: --name --classname --class
Example using --class 'mate-terminal'
option:
(mate-terminal --command 'top' &) && sleep 0.1 && xdotool windowminimize $(xdotool search --class 'mate-terminal' |sort|tail -1)
This should work for gnome:
(gnome-terminal --command 'top' &) && sleep 0.1 && xdotool windowminimize $(xdotool search --class 'gnome-terminal' |sort|tail -1)
I sort output of xdotool search
since newly created window should be last one listed.