开箱。在特定工作区打开不同的 firefox 配置文件
Openbox. Open different firefox profiles in specific workspaces
当我开始我的 openbox 会话时,我需要这样的东西:
firefox -p Profile 1 #Open in workspace 4
firefox -p profile 2 #Open in workspace 5
但我找到的所有解决方案都使用 Windows Name 参数,但效果不是很好。 (我试过修改我的 openbox 的 rc.xml
并使用 wmctrl
和其他几个解决方案,但都是徒劳的)
我的问题有直接的解决方案吗?谢谢!
更新编辑后的答案
这可能有点难看,但我试过了,它似乎有效......
它有点复杂……或者你怎么看?
"sleep" 是必需的,因为它需要时间启动搜索查询以便设置标题 :)
1.Search-query版本:
#!/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.Using 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 }' | 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 }' | head -1`
temp=`xdotool search --all --pid $pid | tail -n -1`
xdotool set_desktop_for_window $temp 1
当我开始我的 openbox 会话时,我需要这样的东西:
firefox -p Profile 1 #Open in workspace 4
firefox -p profile 2 #Open in workspace 5
但我找到的所有解决方案都使用 Windows Name 参数,但效果不是很好。 (我试过修改我的 openbox 的 rc.xml
并使用 wmctrl
和其他几个解决方案,但都是徒劳的)
我的问题有直接的解决方案吗?谢谢!
更新编辑后的答案
这可能有点难看,但我试过了,它似乎有效...... 它有点复杂……或者你怎么看? "sleep" 是必需的,因为它需要时间启动搜索查询以便设置标题 :)
1.Search-query版本:
#!/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.Using 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 }' | 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 }' | head -1`
temp=`xdotool search --all --pid $pid | tail -n -1`
xdotool set_desktop_for_window $temp 1