Window rules
Adding a rule
A rule says which windows it matches and what to do with them:
oxwm.rule.add({ class = "firefox", tag = 2 })
oxwm.rule.add({ instance = "mpv", floating = true })Rules are checked when a window opens.
Matching
| Field | Matches against |
|---|---|
class |
The window class |
instance |
The window instance name |
title |
The window title |
A match is a substring, and it is case sensitive. class = "fire" matches firefox, and class = "Firefox" does not.
If a rule has more than one of these fields, all of them have to match:
oxwm.rule.add({ class = "firefox", title = "Library", floating = true })That floats the Firefox downloads window and leaves the main window tiled.
Finding the class
Run xprop and click the window:
xprop | grep WM_CLASSWM_CLASS(STRING) = "Navigator", "firefox"
The first value is the instance and the second is the class. For the title, look at WM_NAME.
What a rule can set
| Field | Type | Effect |
|---|---|---|
floating |
boolean | Open the window floating |
fullscreen |
boolean | Open the window fullscreen |
tag |
integer | Send the window to this tag |
monitor |
integer | Send the window to this monitor |
focus |
boolean | Switch to the window’s tag when it opens |
width |
number | Starting width in the scrolling layout |
tag counts from 1, so tag = 2 is the second tag. monitor counts from 0, so monitor = 0 is the first monitor.
Examples
Send a chat client to tag 9 and follow it there:
oxwm.rule.add({ class = "discord", tag = 9, focus = true })Float a few utilities:
oxwm.rule.add({ instance = "gimp", floating = true })
oxwm.rule.add({ class = "Pavucontrol", floating = true })
oxwm.rule.add({ title = "Picture-in-Picture", floating = true })Put a game fullscreen on the second monitor:
oxwm.rule.add({ class = "steam_app", fullscreen = true, monitor = 1 })More than one match
Every rule that matches a window is applied, in the order you added them. If two matching rules set a tag, the window gets both tags. For floating, the last matching rule decides, so put the general rules first and the specific ones after.