Libreoffice apps not being assigned to specific workspaces in i3

I use i3 and assign specific apps to specific workspaces using

assign [class="<WM_CLASS value>"] workspacenumber

But when I try this with Libreoffice it doesn’t work. I run:

xprop | grep WM_CLASS

and click on Libreoffice Writer, and it gives me this:

WM_CLASS(STRING) = "libreoffice", "libreoffice-writer"

So I added this line to my i3 config file:

assign [class="libreoffice-writer"] $ws9

and when I open the writer, it opens in the current workspace and not the 9th one.

I tried editing it to:

assign [class="libreoffice-*"] $ws9

and

assign [class="libreoffice"] $ws9

it doesn’t work, but in the second case, when I open the Libreoffice app that is not a specific sub app, the main one, it opens in the specified workspace.
I also tried:

assign [instance="libreoffice"] $ws9

but same thing, writer doesn’t open in the specified workspace, it opens in the current one. But the Libreoffice main app does.

Asked By: an4s911

||

As pointed out by meuh in the comments, I added this line to my i3 config file (with slight changes):

for_window [instance="libreoffice"] move container to workspace $ws9

and it works now. All libreoffice windows are opening in the 9th workspace.

Answered By: an4s911
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.