Skip to content
Advertisement

Openbox. Open different firefox profiles in specific workspaces

I need something like this when I start my openbox session:

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

But all solutions that I’ve found uses the Windows Name parameter, and that doesn’t work very well. (I’ve tried modifying my openbox’s rc.xml and using wmctrl and a couple other solution, but all in vain)

Is there a direct solution for my problem? Thank you!

Advertisement

Answer

UPDATE EDITED ANSWER

This is rather ugly maybe but I tried it and it seems to work… It is a lil bit complicated tho…or what do you think? “sleep” is needed because it needs to time to launch the searchquery so that the title gets set 🙂

1.Search-query version:

#!/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 $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
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement