oxwm github discord tonybtw.com

Tags and monitors

Tags

Tags are oxwm’s answer to workspaces. Every window has at least one tag, and you choose which tags are on screen. In everyday use that feels the same as switching workspaces, but tags can do two things workspaces cannot. You can look at several tags at once, and one window can be on several tags.

Naming tags

oxwm.set_tags({ "1", "2", "3", "4", "5", "6", "7", "8", "9" })

You can have up to 12. The names are only labels:

oxwm.set_tags({ "web", "code", "term", "chat" })

Switching

oxwm.key.bind({ modkey }, "1", oxwm.tag.view(0))
oxwm.key.bind({ modkey, "Shift" }, "1", oxwm.tag.move_to(0))

view shows a tag and move_to sends the focused window to one.

These functions count tags from 0, so the first tag is 0 and the ninth is 8. A loop keeps that readable:

for i = 1, 9 do
    local key = tostring(i)
    oxwm.key.bind({ modkey }, key, oxwm.tag.view(i - 1))
    oxwm.key.bind({ modkey, "Shift" }, key, oxwm.tag.move_to(i - 1))
end

Next and previous

oxwm.key.bind({ modkey }, "Right", oxwm.tag.view_next())
oxwm.key.bind({ modkey }, "Left", oxwm.tag.view_previous())
oxwm.key.bind({ modkey }, "Tab", oxwm.tag.view_next_nonempty())
oxwm.key.bind({ modkey, "Shift" }, "Tab", oxwm.tag.view_previous_nonempty())

The nonempty versions skip tags that have no windows.

Back and forth

oxwm.tag.set_back_and_forth(true)

With this on, pressing the key for the tag you are already on takes you back to the tag you came from.

Several tags at once

oxwm.key.bind({ modkey, "Control" }, "2", oxwm.tag.toggleview(1))

toggleview adds a tag to what is on screen, or removes it. If you are on tag 1 and press Mod+Control+2, you see the windows of tags 1 and 2 together.

One window on several tags

oxwm.key.bind({ modkey, "Control", "Shift" }, "2", oxwm.tag.toggletag(1))

toggletag adds a tag to the focused window, or removes it. A music player tagged with 1 and 2 shows up on both.

More than 9 tags

Add the names, then bind keys for the extra ones:

oxwm.set_tags({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" })

oxwm.key.bind({ modkey }, "0", oxwm.tag.view(9))
oxwm.key.bind({ modkey }, "minus", oxwm.tag.view(10))
oxwm.key.bind({ modkey }, "equal", oxwm.tag.view(11))

Monitors

oxwm finds monitors through Xinerama and picks up changes when you plug one in. Each monitor has its own bar, its own set of tags and its own layout.

oxwm.key.bind({ modkey }, "Comma", oxwm.monitor.focus(-1))
oxwm.key.bind({ modkey }, "Period", oxwm.monitor.focus(1))
oxwm.key.bind({ modkey, "Shift" }, "Comma", oxwm.monitor.tag(-1))
oxwm.key.bind({ modkey, "Shift" }, "Period", oxwm.monitor.tag(1))

focus moves the focus to the previous or next monitor. tag sends the focused window there.

Cursor warping

By default the pointer stays where it is when you change monitors from the keyboard. These two settings move it for you:

oxwm.monitor.warp_cursor(true)
oxwm.monitor.warp_cursor_on_send(true)

The first moves the pointer when you focus another monitor. The second moves it along with a window you send to another monitor.