I would like to know how to open a script in a different workspace while working in another workspace. The script opens different webpages every 2 seconds and it lasts 2 minutes to open all the webpages. It is irritating having to wait finishing all the process. While the process is working I can't do anything because every two seconds another webpage is opened and the screen focuses on that new webpage.
This is an example of the script:
#!/bin/bash
# Defining the screen size
a="$(xrandr | fgrep '*' | awk -F ' ' '{print $1}' | awk -F 'x' '{print $1}')"
b="$(xrandr | fgrep '*' | awk -F ' ' '{print $1}' | awk -F 'x' '{print $2}')"
# First tab
opera --new-window
sleep 1;
wmctrl -r :ACTIVE: -e 1,$((0)),$((0)),$((a)),$((b)) ;
sleep 2;
# Second tab
opera --new-window
sleep 2;
# Third tab
opera --new-window
sleep 2;
...
# n tab
opera --new-window
I have tried to use wmctrl command sending each new opera tab to second workspace...
wmctrl -s 1 #Switches to workspace 1
opera --new-window &
sleep 2;
... but the screen put the focus in that workspace and I can't work in the program I am using at that moment. So the idea is to work in other program while the script is executing in other workspace.
Other ineffective solution is to keep my workspace in the workspace 1 and to open the new tab in the workspace 2 in a very small time period. I mean:
wmctrl -s 0; # The workspace I am working in.
wmctrl -s 1; opera --new-window & sleep 0.01; #Change to workspace 2 and open the new tab in a short time.
wmctrl -s 0; # Change to workspace 1.
sleep 2;
wmctrl -s 1; opera --new-window & sleep 0.01;
wmctrl -s 0 #... and so on.
This is not effective. I notice the change between workspaces.
I am using: Xubuntu 14.04. Desktop environment Xfce. Window manager Xfwm4.
Any ideas?