oxwm github discord tonybtw.com

Status bar

Overview

oxwm draws one bar per monitor. From left to right it shows the tags, the layout symbol, the focused window title and your blocks.

Font and position

oxwm.bar.set_font("monospace:style=Bold:size=10")
oxwm.bar.set_position("bottom")

The font is a fontconfig pattern. Run fc-list to see what you have installed. The position is top or bottom, and top is the default.

To show and hide the bar from the keyboard:

oxwm.key.bind({ modkey }, "B", oxwm.toggle_bar())

Blocks

Blocks are the pieces of text on the right side of the bar. Build a list with the block constructors and pass it to set_blocks:

oxwm.bar.set_blocks({
    oxwm.bar.block.ram({
        format = "Ram: {used}/{total} GB",
        interval = 5,
        color = "#7aa2f7",
        underline = true,
    }),
    oxwm.bar.block.datetime({
        format = "{}",
        date_format = "%a, %b %d - %-I:%M %P",
        interval = 1,
        color = "#0db9d7",
        underline = true,
    }),
})

They are drawn in the order you list them.

Common fields

Every block takes these:

Field Type Meaning
format string The text to draw. {} is replaced with the block’s value
interval integer Seconds between updates
color color Text color
underline boolean Draw a line under the block
click string or table Command to run when the block is clicked

ram

Memory in use. The format understands {used} and {total}, both in GB.

oxwm.bar.block.ram({
    format = "Ram: {used}/{total} GB",
    interval = 5,
    color = "#7aa2f7",
    underline = true,
})

datetime

The clock. date_format is a strftime pattern, and the result replaces {} in format. The supported codes are %Y, %m, %d, %H, %M, %S, %I, %p, %P, %a and %b. A dash removes the zero padding, so %-I prints 9 where %I prints 09.

oxwm.bar.block.datetime({
    format = "{}",
    date_format = "%H:%M",
    interval = 60,
    color = "#0db9d7",
    underline = true,
})

shell

Runs a command and shows its output.

oxwm.bar.block.shell({
    format = "{}",
    command = "uname -r",
    interval = 3600,
    color = "#f7768e",
    underline = true,
})

static

Fixed text. Handy as a separator between other blocks.

oxwm.bar.block.static({
    text = "|",
    interval = 3600,
    color = "#a9b1d6",
    underline = false,
})

battery

Battery charge, with a different format for each state. {} is the percentage.

oxwm.bar.block.battery({
    format = "Bat: {}%",
    charging = "+ Bat: {}%",
    discharging = "- Bat: {}%",
    full = "Bat: full",
    interval = 30,
    color = "#9ece6a",
    underline = true,
})

It reads BAT0 unless you say otherwise. If your battery has another name under /sys/class/power_supply, set battery_name = "BAT1".

systray

Adding this block turns on the system tray. Leave it out and there is no tray.

oxwm.bar.block.systray()

The tray appears on the first monitor’s bar, at the place the block has in your list.

Clickable blocks

Give a block a click command and it runs when you click the block:

oxwm.bar.block.ram({
    format = "Ram: {used}/{total} GB",
    interval = 5,
    color = "#7aa2f7",
    underline = true,
    click = "alacritty -e btop",
})

Use a table if you want the window it opens to float:

click = { command = "alacritty -e bluetui", floating = true }

Set bypass_rules = true in the same table to stop your window rules from applying to that window.

Tag colors

Each tag is drawn with one of four schemes, depending on its state. A scheme is three colors: foreground, background and underline.

oxwm.bar.set_scheme_normal("#bbbbbb", "#1a1b26", "#444444")
oxwm.bar.set_scheme_occupied("#0db9d7", "#1a1b26", "#0db9d7")
oxwm.bar.set_scheme_selected("#0db9d7", "#1a1b26", "#ad8ee6")
oxwm.bar.set_scheme_urgent("#f7768e", "#1a1b26", "#f7768e")
Scheme Used for
normal Tags with no windows
occupied Tags that have windows
selected The tag you are looking at
urgent Tags where a window wants attention

Hiding empty tags

oxwm.bar.set_hide_vacant_tags(true)

With this on, the bar only shows tags that have windows, plus the selected one.

Mouse

Click a tag in the bar to switch to it.