oxwm github discord tonybtw.com

Keybindings

Binding a key

oxwm.key.bind({ "Mod4" }, "Return", oxwm.spawn_terminal())
oxwm.key.bind({ "Mod4", "Shift" }, "Q", oxwm.quit())

oxwm.key.bind takes a list of modifiers, a key name and an action.

Modifiers

Name Key
Mod4 or super Super
Mod1 or alt Alt
Shift Shift
Control or ctrl Control

Pass an empty list for a binding with no modifier:

oxwm.key.bind({}, "Print", oxwm.spawn("flameshot gui"))

Key names

Letters and digits are written as they are. "Q" and "q" are the same key.

Group Names
Editing Return, Space, Tab, Escape, BackSpace, Delete, Print
Arrows Left, Right, Up, Down
Function keys F1 to F12
Punctuation Comma, Period, Slash, Minus, Equal, bracketleft, bracketright, backslash, semicolon, colon, apostrophe, grave
Volume XF86AudioRaiseVolume, XF86AudioLowerVolume, XF86AudioMute
Media XF86AudioPlay, XF86AudioPause, XF86AudioNext, XF86AudioPrev
Brightness XF86MonBrightnessUp, XF86MonBrightnessDown

A binding with a key name oxwm does not know is skipped.

Running programs

oxwm.spawn takes a command line. It is run through the shell, so pipes and arguments work:

oxwm.key.bind({ modkey }, "D", oxwm.spawn("dmenu_run -l 10"))
oxwm.key.bind({ modkey }, "S", oxwm.spawn("maim -s | xclip -selection clipboard -t image/png"))

Pass the command as one string. A table is accepted too, but only the { "sh", "-c", "command" } form keeps its arguments.

Media keys are a good use for bindings with no modifier:

oxwm.key.bind({}, "XF86AudioRaiseVolume", oxwm.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%"))
oxwm.key.bind({}, "XF86AudioLowerVolume", oxwm.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%"))
oxwm.key.bind({}, "XF86AudioMute", oxwm.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle"))
oxwm.key.bind({}, "XF86MonBrightnessUp", oxwm.spawn("brightnessctl set +5%"))
oxwm.key.bind({}, "XF86MonBrightnessDown", oxwm.spawn("brightnessctl set 5%-"))

Keychords

A keychord is a sequence of keys, like a leader key in Vim. Pass a list of steps to oxwm.key.chord, where each step is a modifier list and a key:

oxwm.key.chord({
    { { modkey }, "Space" },
    { {}, "T" },
}, oxwm.spawn_terminal())

Press Mod+Space, let go, then press T.

Several chords can share a first step, which gives you a menu of sorts:

oxwm.key.chord({ { { modkey }, "Space" }, { {}, "B" } }, oxwm.spawn("firefox"))
oxwm.key.chord({ { { modkey }, "Space" }, { {}, "F" } }, oxwm.spawn("thunar"))
oxwm.key.chord({ { { modkey }, "Space" }, { {}, "M" } }, oxwm.spawn("spotify"))

A chord can be up to four steps long. If you wait more than a second between keys, the sequence starts over.

Keybind overlay

oxwm.key.bind({ modkey, "Shift" }, "Slash", oxwm.show_keybinds())

This draws a list of your bindings over the screen. Press Escape or Q to close it.

Default bindings

These come from the config that oxwm --init writes. Mod is Super.

Windows

Key Action
Mod+Return Open a terminal
Mod+D Run dmenu
Mod+S Screenshot a region to the clipboard (maim, xclip)
Mod+Q Close the focused window
Mod+J / Mod+K Focus the next or previous window
Mod+Shift+J / Mod+Shift+K Move the window down or up the stack
Mod+Shift+Space Toggle floating
Mod+Shift+F Toggle fullscreen

Layouts

Key Action
Mod+C Tiling layout
Mod+F Floating layout
Mod+N Cycle layouts
Mod+H / Mod+L Shrink or grow the master area
Mod+I / Mod+P More or fewer master windows
Mod+A Toggle gaps
Mod+B Toggle the bar

Tags

Key Action
Mod+1 to Mod+9 View a tag
Mod+Shift+1 to Mod+Shift+9 Move the window to a tag
Mod+Control+1 to Mod+Control+9 Add or remove a tag from the view
Mod+Control+Shift+1 to Mod+Control+Shift+9 Add or remove a tag from the window

Monitors

Key Action
Mod+Comma / Mod+Period Focus the previous or next monitor
Mod+Shift+Comma / Mod+Shift+Period Send the window to the previous or next monitor

Session

Key Action
Mod+Shift+/ Show the keybind overlay
Mod+Shift+R Reload the config
Mod+Shift+Q Quit oxwm
Mod+Space then T Open a terminal (keychord)