2015-10-16 17 views
1

我需要像這樣打開不同的Firefox配置當我開始我的openbox會話:Openbox。在具體的工作區

firefox -p Profile 1 #Open in workspace 4 
firefox -p profile 2 #Open in workspace 5 

但我發現所有的解決方案使用的Windows 名稱參數,並且不工作很好。 (我試過修改我的openbox的rc.xml和使用wmctrl和其他一些解決方案,但都是徒勞)

是否有直接解決我的問題?謝謝!

+0

例如,將rc.xml設置爲: 不起作用,因爲不同的配置文件具有相同的類。 (http://openbox.org/wiki/Help:Applications) – rubensoleao

回答

0

UPDATE EDITED ANSWER

這是相當醜陋,也許,但我嘗試過了,它似乎工作... 這是一個可愛的有點複雜壽...或者你覺得呢?需要 「睡眠」,因爲它需要時間來啓動SEARCHQUERY使標題設置了:)

1.Search查詢版本:

#!/bin/bash 

firefox -P test1 --new-instance --search "profile1" & 
firefox -P test2 --new-instance --search "profile2" & 
sleep 3; 

#profile1 to desktop 0 
wmctrl -r "profile1" -t 0 

#profile2 to desktop 1 
wmctrl -r "profile2" -t 1 

2.使用xdotool:

#!/bin/bash 

temp=""; 
pid=""; 

firefox -P test1 --new-instance & 
firefox -P test2 --new-instance & 
sleep 1; 

#profile1 to desktop 0 
pid=`ps aux | grep test1 | awk '{print $2}' | head -1` 
temp=`xdotool search --all --pid $pid | tail -n -1` 
xdotool set_desktop_for_window $temp 0 

#profile2 to desktop 1 
pid=`ps aux | grep test2 | awk '{print $2}' | head -1` 
temp=`xdotool search --all --pid $pid | tail -n -1` 
xdotool set_desktop_for_window $temp 1 
+0

我試過這種方式,但它不起作用。他們在同一個工作區中打開 – rubensoleao

+0

唯一的這個作品是,如果我等幾秒鐘讓Firefox打開,然後更改工作區並打開一個不同的Firefox配置文件 – rubensoleao

+0

我做了更新。你對這個解決方案有什麼看法? – dikatlon