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 first 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.
So the idea is to work in one program while the script is executing in other workspace.
I am using: Xubuntu 14.04. Desktop environment Xfce. Window manager Xfwm4.
Any ideas?
opera
(orfirefox
orchromium
etc), even when you run them in the background they tend to pop up the new window in the foreground over the top of your terminal and "steal" the focus anyway. Some programs may have options to prevent that. I don't have opera installed so don't know if it does. And, of course, you're tellingwmctrl
to switch workspaces so you're always going to notice that. – cas Aug 6 '17 at 2:34lisp
-like scripting language) which can be programmed to, e.g., automatically move windows with particular attributes (like window name or process name of the owner pid) to another workspace, or auto-minimise them, or change other attributes (e.g. size, style of window, decorations, etc) automatically. – cas Aug 19 '17 at 0:07