由于我的懒惰,我尝试编写一个Bash脚本,可以在不同的桌面同时打开一些常用应用程序。这个脚本应该可以在Gnome环境下运行。到目前为止,我已经写了如下内容:
#!/bin/bash
firefox &
thunderbird &
/usr/bin/netbeans --locale en &
amsn &
gnome-terminal &
sleep 2
wmctrl -r firefox -t 0 && wmctrl -r netbeans -t 1 && wmctrl -r gnome-terminal -t 2 && wmctrl -r amsn -t 6 && wmctrl -r thunderbird -t 7
...但是它不起作用。我的应用程序打开了,但它们没有被分配到我指定的桌面 :(。
我将sleep的值更改为15.,但只有firefox和netbeans被正确地分配;其余的在我执行脚本的工作区中打开。
sleep 15
。那时我才意识到,在使用wmctrl
操纵窗口之前,需要给应用程序一些时间来启动。 - Serge Stroobandt