The i3 FAQ has migrated to https://www.reddit.com/r/i3wm/. All content here is read-only.

# Open in specific window

Hello,

There are some websites that I like to keep running in their own windows (instead of tabs), and dedicate a workspace for them (a music workspace, a webmail workspace, etc.). Therefore, I have created simple shell scripts such as

#!/bin/bash


to launch them and added them to my PATH. On my config file, however, I already have

assign [class="Firefox"] 2. www


which opens generic Firefox on the 2. www workspace. How could I configure i3 to open these specific pages in the right workspaces?

I though about using i3-msg, but I figured that even if I change to the correct workspace, when I launch the script it will recognize it as Firefox window and will apply the assign configured in the config file.

edit retag close merge delete

generally, have you considered spreading your browser windows across your workspaces (like treating any website as an application)? because, first, you want to have a radio web application seperated, next can be anything?

( 2013-05-16 12:36:51 +0000 )edit

I'm not sure I got what you mean. Yes, I want to spread my browser windows across workspaces, one for a radio web application, one for webmail and another for general browsing.

( 2013-05-16 12:47:42 +0000 )edit

sorry for the abiguity, i meant reconsidering the assign [class="Firefox"] 2. www line altogether, to be direct.

( 2013-05-16 13:08:21 +0000 )edit

Sort by » oldest newest most voted

As specified in command_criteria you can also match on title:

[class="Firefox" title="(?i)jazzradio.com"] 3.jazzradio

more

great, thanks! I just had to change the regex a little to match it.

( 2013-05-15 15:33:37 +0000 )edit

Actually, I just realized that this was throwing all my Firefox instances to the jazzradio workspace. I think this is related to the fact that I use Vimperator, as noted in the documentation.

( 2013-05-15 17:27:51 +0000 )edit
1

I removed Vimperator, but that didn't solve it. Assigning based on the title doesn't work, since Firefox always creates the windows as "Mozilla Firefox" and only later changes their name - but by then i3 has already catched the window and placed it in the appropriate (current) window.

( 2013-05-27 13:30:07 +0000 )edit

Not exactly pretty, but what I did was to remove the Firefox assignment from the config. Then I modified my shell script to the following

CURRENT_WORKSPACE=$(i3_current_workspace_focused.py) i3-msg "workspace 10. ♪" firefox -new-window www.jazzradio.com/guitarjazz sleep 1 i3-msg "workspace$CURRENT_WORKSPACE"


where i3_current_workspace_focused,py is

#!/usr/bin/python

from commands import getoutput
import json

workspaces = getoutput("i3-msg -t get_workspaces")

for w in workspaces:
if w['visible'] == True and w['focused'] == True:
print w['name']
break

more