OXWMOXWM

API Reference

Complete Lua API reference for OXWM

Complete reference for the OXWM Lua configuration API.

Colors can be specified as hex strings ("#ff0000", "0xff0000") or integers.

Global Functions

oxwm.spawn

Spawn a command.

oxwm.spawn(cmd)
ParameterTypeDescription
cmdstring | string[]Command to spawn (string or array of strings)

Returns: Action table for keybinding

oxwm.key.bind({ "Mod4" }, "D", oxwm.spawn("dmenu_run"))
oxwm.key.bind({ "Mod4" }, "B", oxwm.spawn({ "sh", "-c", "firefox" }))

oxwm.spawn_terminal

Spawn the configured terminal emulator.

oxwm.spawn_terminal()

Returns: Action table for keybinding

oxwm.set_terminal

Set the terminal emulator.

oxwm.set_terminal(terminal)
ParameterTypeDescription
terminalstringTerminal command (e.g., "st", "alacritty")

oxwm.set_modkey

Set the modifier key (used for mouse bindings like drag/resize).

oxwm.set_modkey(modkey)
ParameterTypeDescription
modkeystringModifier key ("Mod1", "Mod4", "Shift", "Control")

oxwm.set_tags

Set workspace tags.

oxwm.set_tags(tags)
ParameterTypeDescription
tagsstring[]Array of tag names
oxwm.set_tags({ "1", "2", "3", "4", "5", "6", "7", "8", "9" })
-- Or with icons (requires Nerd Font)
oxwm.set_tags({ "", "󰊯", "", "", "󰙯" })

oxwm.set_layout_symbol

Set custom symbol for a layout (displayed in status bar).

oxwm.set_layout_symbol(name, symbol)
ParameterTypeDescription
namestringLayout name ("tiling", "normie", "tabbed", "grid", "monocle")
symbolstringSymbol to display (e.g., "[T]", "[F]")

oxwm.quit

Quit the window manager.

oxwm.quit()

Returns: Action table for keybinding

oxwm.restart

Restart the window manager (hot reload).

oxwm.restart()

Returns: Action table for keybinding

oxwm.recompile

Recompile the window manager.

oxwm.recompile()

Returns: Action table for keybinding

oxwm.toggle_gaps

Toggle gaps on/off.

oxwm.toggle_gaps()

Returns: Action table for keybinding

oxwm.show_keybinds

Show keybind overlay on screen.

oxwm.show_keybinds()

Returns: Action table for keybinding

oxwm.set_master_factor

Adjust master area width in tiling layout.

oxwm.set_master_factor(delta)
ParameterTypeDescription
deltaintegerDelta to adjust by (negative to decrease, positive to increase)

Returns: Action table for keybinding

oxwm.inc_num_master

Increment/decrement number of master windows.

oxwm.inc_num_master(delta)
ParameterTypeDescription
deltaintegerDelta to adjust by (negative to decrease, positive to increase)

Returns: Action table for keybinding

oxwm.autostart

Add an autostart command (runs once when OXWM starts).

oxwm.autostart(cmd)
ParameterTypeDescription
cmdstringCommand to run at startup
oxwm.autostart("picom")
oxwm.autostart("feh --bg-scale ~/wallpaper.jpg")

oxwm.key

Keybinding module.

oxwm.key.bind

Bind a key combination to an action.

oxwm.key.bind(modifiers, key, action)
ParameterTypeDescription
modifiersstring | string[]Modifier keys (e.g., {"Mod4"}, {"Mod4", "Shift"})
keystringKey name (e.g., "Return", "Q", "1")
actiontableAction returned by oxwm functions
oxwm.key.bind({ "Mod4" }, "Return", oxwm.spawn_terminal())
oxwm.key.bind({ "Mod4", "Shift" }, "Q", oxwm.quit())

oxwm.key.chord

Bind a keychord (multi-key sequence) to an action.

oxwm.key.chord(keys, action)
ParameterTypeDescription
keystable[]Array of key presses, each: {{modifiers}, key}
actiontableAction returned by oxwm functions
-- Press Mod4+Space, then T to spawn terminal
oxwm.key.chord({
    { { "Mod4" }, "Space" },
    { {}, "T" }
}, oxwm.spawn_terminal())

oxwm.gaps

Gap configuration module.

oxwm.gaps.set_enabled

Set gaps enabled/disabled.

oxwm.gaps.set_enabled(enabled)
ParameterTypeDescription
enabledbooleanEnable or disable gaps

oxwm.gaps.enable

Enable gaps.

oxwm.gaps.enable()

oxwm.gaps.disable

Disable gaps.

oxwm.gaps.disable()

oxwm.gaps.set_inner

Set inner gaps (between windows).

oxwm.gaps.set_inner(horizontal, vertical)
ParameterTypeDescription
horizontalintegerHorizontal inner gap in pixels
verticalintegerVertical inner gap in pixels

oxwm.gaps.set_outer

Set outer gaps (between windows and screen edge).

oxwm.gaps.set_outer(horizontal, vertical)
ParameterTypeDescription
horizontalintegerHorizontal outer gap in pixels
verticalintegerVertical outer gap in pixels

oxwm.gaps.set_smart

Set smart gaps (disable outer gaps when only one window visible).

oxwm.gaps.set_smart(enabled)
ParameterTypeDescription
enabledbooleanEnable or disable smart gaps

oxwm.border

Border configuration module.

oxwm.border.set_width

Set border width.

oxwm.border.set_width(width)
ParameterTypeDescription
widthintegerBorder width in pixels

oxwm.border.set_focused_color

Set focused window border color.

oxwm.border.set_focused_color(color)
ParameterTypeDescription
colorstring | integerColor as hex string or integer

oxwm.border.set_unfocused_color

Set unfocused window border color.

oxwm.border.set_unfocused_color(color)
ParameterTypeDescription
colorstring | integerColor as hex string or integer

oxwm.client

Client/window management module.

oxwm.client.kill

Kill the focused window.

oxwm.client.kill()

Returns: Action table for keybinding

oxwm.client.toggle_fullscreen

Toggle fullscreen mode.

oxwm.client.toggle_fullscreen()

Returns: Action table for keybinding

oxwm.client.toggle_floating

Toggle floating mode.

oxwm.client.toggle_floating()

Returns: Action table for keybinding

oxwm.client.focus_stack

Focus next/previous window in stack.

oxwm.client.focus_stack(dir)
ParameterTypeDescription
dirintegerDirection (1 for next, -1 for previous)

Returns: Action table for keybinding

oxwm.client.move_stack

Move window in stack (swap position).

oxwm.client.move_stack(dir)
ParameterTypeDescription
dirintegerDirection (1 for next, -1 for previous)

Returns: Action table for keybinding


oxwm.monitor

Monitor management module.

oxwm.monitor.focus

Focus monitor.

oxwm.monitor.focus(dir)
ParameterTypeDescription
dirintegerDirection (-1 for previous, 1 for next)

Returns: Action table for keybinding

oxwm.monitor.tag

Send focused window to monitor.

oxwm.monitor.tag(dir)
ParameterTypeDescription
dirintegerDirection (-1 for previous, 1 for next)

Returns: Action table for keybinding


oxwm.layout

Layout management module.

oxwm.layout.cycle

Cycle through layouts.

oxwm.layout.cycle()

Returns: Action table for keybinding

oxwm.layout.set

Set specific layout.

oxwm.layout.set(name)
ParameterTypeDescription
namestringLayout name ("tiling", "normie", "tabbed", "grid", "monocle")

Returns: Action table for keybinding


oxwm.tag

Tag/workspace management module.

Tags are 0-indexed, so tag "1" is index 0.

oxwm.tag.view

View/switch to tag.

oxwm.tag.view(index)
ParameterTypeDescription
indexintegerTag index (0-based)

Returns: Action table for keybinding

oxwm.tag.move_to

Move focused window to tag.

oxwm.tag.move_to(index)
ParameterTypeDescription
indexintegerTag index (0-based)

Returns: Action table for keybinding

oxwm.tag.toggleview

Toggle viewing a tag (allows viewing multiple tags at once).

oxwm.tag.toggleview(index)
ParameterTypeDescription
indexintegerTag index (0-based)

Returns: Action table for keybinding

oxwm.tag.toggletag

Toggle tag on focused window (allows window to appear on multiple tags).

oxwm.tag.toggletag(index)
ParameterTypeDescription
indexintegerTag index (0-based)

Returns: Action table for keybinding


oxwm.rule

Window rule module.

oxwm.rule.add

Add a window rule.

oxwm.rule.add(rule)
ParameterTypeDescription
ruletableRule configuration (see below)

Rule properties:

PropertyTypeDescription
classstring?Window class to match
instancestring?Window instance to match
titlestring?Window title to match
rolestring?Window role to match
floatingboolean?Force floating mode
taginteger?Send to specific tag
fullscreenboolean?Force fullscreen mode
oxwm.rule.add({ instance = "gimp", floating = true })
oxwm.rule.add({ class = "firefox", title = "Library", floating = true })
oxwm.rule.add({ class = "Spotify", tag = 8 })

Use xprop and click on a window to find its class/instance. WM_CLASS(STRING) shows both instance and class.


oxwm.bar

Status bar configuration module.

oxwm.bar.set_font

Set status bar font.

oxwm.bar.set_font(font)
ParameterTypeDescription
fontstringFont string (e.g., "monospace:style=Bold:size=10")

oxwm.bar.set_blocks

Set status bar blocks.

oxwm.bar.set_blocks(blocks)
ParameterTypeDescription
blockstable[]Array of block configurations created with oxwm.bar.block.*

oxwm.bar.set_scheme_normal

Set color scheme for unoccupied tags.

oxwm.bar.set_scheme_normal(foreground, background, underline)
ParameterTypeDescription
foregroundstring | integerForeground color
backgroundstring | integerBackground color
underlinestring | integerUnderline color

oxwm.bar.set_scheme_occupied

Set color scheme for occupied tags (has windows).

oxwm.bar.set_scheme_occupied(foreground, background, underline)
ParameterTypeDescription
foregroundstring | integerForeground color
backgroundstring | integerBackground color
underlinestring | integerUnderline color

oxwm.bar.set_scheme_selected

Set color scheme for selected tag.

oxwm.bar.set_scheme_selected(foreground, background, underline)
ParameterTypeDescription
foregroundstring | integerForeground color
backgroundstring | integerBackground color
underlinestring | integerUnderline color

oxwm.bar.block

Block constructors for status bar.

oxwm.bar.block.ram

Create a RAM usage block.

oxwm.bar.block.ram(config)
ConfigTypeDescription
formatstringFormat string with {used} and {total} placeholders
intervalintegerUpdate interval in seconds
colorstring | integerText color
underlinebooleanWhether to underline the block
oxwm.bar.block.ram({
    format = "RAM: {used}/{total} GB",
    interval = 5,
    color = "#7aa2f7",
    underline = true,
})

oxwm.bar.block.datetime

Create a date/time block.

oxwm.bar.block.datetime(config)
ConfigTypeDescription
formatstringDisplay template with {} placeholder
date_formatstringstrftime format string
intervalintegerUpdate interval in seconds
colorstring | integerText color
underlinebooleanWhether to underline the block
oxwm.bar.block.datetime({
    format = "{}",
    date_format = "%a, %b %d - %-I:%M %P",
    interval = 1,
    color = "#0db9d7",
    underline = true,
})

oxwm.bar.block.shell

Create a shell command block.

oxwm.bar.block.shell(config)
ConfigTypeDescription
formatstringFormat string with {} placeholder for command output
commandstringShell command to execute
intervalintegerUpdate interval in seconds
colorstring | integerText color
underlinebooleanWhether to underline the block
oxwm.bar.block.shell({
    format = "{}",
    command = "uname -r",
    interval = 999999999,
    color = "#f7768e",
    underline = true,
})

oxwm.bar.block.static

Create a static text block.

oxwm.bar.block.static(config)
ConfigTypeDescription
textstringStatic text to display
intervalintegerUpdate interval (use high value for static)
colorstring | integerText color
underlinebooleanWhether to underline the block
oxwm.bar.block.static({
    text = " │ ",
    interval = 999999999,
    color = "#a9b1d6",
    underline = false,
})

oxwm.bar.block.battery

Create a battery status block.

oxwm.bar.block.battery(config)
ConfigTypeDescription
formatstringDefault format with {} placeholder
chargingstringFormat when charging
dischargingstringFormat when discharging
fullstringFormat when full
intervalintegerUpdate interval in seconds
colorstring | integerText color
underlinebooleanWhether to underline the block
oxwm.bar.block.battery({
    format = "Bat: {}%",
    charging = "⚡ Bat: {}%",
    discharging = "- Bat: {}%",
    full = "✓ Bat: {}%",
    interval = 30,
    color = "#9ece6a",
    underline = true,
})

On this page