Open a specific workspace on i3 when launching a specific app

This week, I finally deciced to write in my i3 config file. Since I use firefox a lot I defined a shortcut for it (bindsym $mod+Shift+f exec firefox) and assigned firefox to a workspace (assign [class="Firefox"]$ws2).

My question is: what can I add to the line bindsym $mod+Shift+f exec firefox so that when I open firefox, the focus changes to the corresponding workspace (here, $ws2)?

1

1 Answer

You can change to specific workspace using i3-msg (in Your case):

exec i3-msg "workspace $ws2"

More general example from the i3 documentation website:

Documentation:

# Start iceweasel on workspace 3, then switch back to workspace 1
# (Being a command-line utility, i3-msg does not support startup notifications,
# hence the exec --no-startup-id.)
# (Starting iceweasel with i3’s exec command is important in order to make i3
# create a startup notification context, without which the iceweasel window(s)
# cannot be matched onto the workspace on which the command was started.)
exec --no-startup-id i3-msg 'workspace 3; exec iceweasel; workspace 1'

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like