| 1 | ---@meta |
| 2 | ------------------------------------------------------------------------------- |
| 3 | -- OXWM Configuration File |
| 4 | ------------------------------------------------------------------------------- |
| 5 | -- This is the default configuration for OXWM, a dynamic window manager. |
| 6 | -- Edit this file and reload with Mod+Shift+R (no compilation needed) |
| 7 | -- |
| 8 | -- For more information about configuring OXWM, see the documentation. |
| 9 | -- The Lua Language Server provides autocomplete and type checking. |
| 10 | ------------------------------------------------------------------------------- |
| 11 | |
| 12 | ---Load type definitions for LSP |
| 13 | ---@module 'oxwm' |
| 14 | |
| 15 | ------------------------------------------------------------------------------- |
| 16 | -- Variables |
| 17 | ------------------------------------------------------------------------------- |
| 18 | -- Define your variables here for easy customization throughout the config. |
| 19 | -- This makes it simple to change keybindings, colors, and settings in one place. |
| 20 | |
| 21 | -- Modifier key: "Mod4" is the Super/Windows key, "Mod1" is Alt |
| 22 | local modkey = "Mod4" |
| 23 | |
| 24 | -- Terminal emulator command (defaults to alacritty) |
| 25 | local terminal = "wezterm" |
| 26 | |
| 27 | -- Color palette - customize these to match your theme |
| 28 | -- Alternatively you can import other files in here, such as |
| 29 | -- local colors = require("colors.lua") and make colors.lua a file |
| 30 | -- in the ~/.config/oxwm directory |
| 31 | -- Darkmatter (matches wezterm/ghostty theme) |
| 32 | local colors = { |
| 33 | fg = "#ffffff", |
| 34 | red = "#e78a53", |
| 35 | bg = "#121113", |
| 36 | cyan = "#aaaaaa", |
| 37 | green = "#fbcb97", |
| 38 | lavender = "#999999", |
| 39 | light_blue = "#888888", |
| 40 | grey = "#333333", |
| 41 | blue = "#5f8787", |
| 42 | purple = "#c1c1c1", |
| 43 | } |
| 44 | |
| 45 | -- Workspace tags - can be numbers, names, or icons (requires a Nerd Font) |
| 46 | -- The number of tags is deduced from the size of this table (up to a max of 12). |
| 47 | -- The default is 9. To use more, add entries here and uncomment the matching |
| 48 | -- keybinds for tags 10-12 further down in this file. |
| 49 | local tags = { "1", "2", "3", "4", "5", "6", "7", "8", "9" } |
| 50 | -- local tags = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" } -- Example of 12 tags |
| 51 | -- local tags = { "", "", "", "", "", "", "", "", "" } -- Example of nerd font icon tags |
| 52 | |
| 53 | -- Font for the status bar (use "fc-list" to see available fonts) |
| 54 | local bar_font = "BerkeleyMono Nerd Font:style=Bold:size=11" |
| 55 | |
| 56 | -- Define your blocks |
| 57 | -- Similar to widgets in qtile, or dwmblocks |
| 58 | local blocks = { |
| 59 | oxwm.bar.block.ram({ |
| 60 | format = "Ram: {used}/{total} GB", |
| 61 | interval = 5, |
| 62 | color = colors.blue, |
| 63 | underline = true, |
| 64 | }), |
| 65 | oxwm.bar.block.static({ |
| 66 | text = "│", |
| 67 | interval = 999999999, |
| 68 | color = colors.green, |
| 69 | underline = false, |
| 70 | }), |
| 71 | -- oxwm.bar.block.shell({ |
| 72 | -- format = "{}", |
| 73 | -- command = "uname -r", |
| 74 | -- interval = 999999999, |
| 75 | -- color = colors.red, |
| 76 | -- underline = true, |
| 77 | -- }), |
| 78 | -- oxwm.bar.block.static({ |
| 79 | -- text = "│", |
| 80 | -- interval = 999999999, |
| 81 | -- color = colors.lavender, |
| 82 | -- underline = false, |
| 83 | -- }), |
| 84 | oxwm.bar.block.datetime({ |
| 85 | format = "{}", |
| 86 | date_format = "%a, %b %d - %-I:%M %P", |
| 87 | interval = 1, |
| 88 | color = colors.cyan, |
| 89 | underline = true, |
| 90 | }), |
| 91 | -- Uncomment to add battery status (useful for laptops) |
| 92 | oxwm.bar.block.battery({ |
| 93 | format = "Bat: {}%", |
| 94 | charging = "⚡ Bat: {}%", |
| 95 | discharging = "- Bat: {}%", |
| 96 | full = "✓ Bat: {}%", |
| 97 | interval = 30, |
| 98 | color = colors.green, |
| 99 | underline = true, |
| 100 | -- click: run a command when the block is clicked |
| 101 | -- click = "alacritty -e btop", |
| 102 | -- click = { command = "bluetui", floating = true }, |
| 103 | }), |
| 104 | }; |
| 105 | |
| 106 | ------------------------------------------------------------------------------- |
| 107 | -- Basic Settings |
| 108 | ------------------------------------------------------------------------------- |
| 109 | oxwm.set_terminal(terminal) |
| 110 | oxwm.set_modkey(modkey) -- This is for Mod + mouse binds, such as drag/resize |
| 111 | oxwm.set_tags(tags) |
| 112 | |
| 113 | -- Set default layout (tiling by default) |
| 114 | -- oxwm.set_layout("tiling") |
| 115 | |
| 116 | ------------------------------------------------------------------------------- |
| 117 | -- Layouts |
| 118 | ------------------------------------------------------------------------------- |
| 119 | -- Set custom symbols for layouts (displayed in the status bar) |
| 120 | -- Available layouts: "tiling", "normie" (floating), "grid", "monocle", "tabbed", "dwindle" |
| 121 | oxwm.set_layout_symbol("normie", "[F]") |
| 122 | oxwm.set_layout_symbol("tiling", "[T]") |
| 123 | oxwm.set_layout_symbol("tabbed", "[=]") |
| 124 | oxwm.set_layout_symbol("dwindle", "[\\]") |
| 125 | |
| 126 | -- Example: bind dwindle (fibonacci) layout |
| 127 | oxwm.key.bind({ modkey }, "R", oxwm.layout.set("dwindle")) |
| 128 | |
| 129 | -- Set default layout of specific tag (tag_index, layout_name) |
| 130 | -- Unset value uses oxwm.set_layout value |
| 131 | -- oxwm.set_tag_layout(1, "grid") |
| 132 | |
| 133 | ------------------------------------------------------------------------------- |
| 134 | -- Appearance |
| 135 | ------------------------------------------------------------------------------- |
| 136 | -- Border configuration |
| 137 | |
| 138 | -- Width in pixels |
| 139 | oxwm.border.set_width(2) |
| 140 | -- Color of focused window border |
| 141 | oxwm.border.set_focused_color(colors.blue) |
| 142 | -- Color of unfocused window borders |
| 143 | oxwm.border.set_unfocused_color(colors.grey) |
| 144 | |
| 145 | -- Where floating windows spawn: "top-left", "top-center", "top-right", |
| 146 | -- "center-left", "center", "center-right", "bottom-left", "bottom-center", "bottom-right" |
| 147 | oxwm.set_floating_position("top-right") |
| 148 | |
| 149 | -- Smart Enabled = No border if 1 window |
| 150 | oxwm.gaps.set_smart(false) |
| 151 | -- Inner gaps (horizontal, vertical) in pixels |
| 152 | oxwm.gaps.set_inner(12, 12) |
| 153 | -- Outer gaps (horizontal, vertical) in pixels |
| 154 | oxwm.gaps.set_outer(12, 12) |
| 155 | |
| 156 | ------------------------------------------------------------------------------- |
| 157 | -- Window Rules |
| 158 | ------------------------------------------------------------------------------- |
| 159 | -- Rules allow you to automatically configure windows based on their properties |
| 160 | -- You can match windows by class, instance, title, or role |
| 161 | -- Available properties: floating, tag, fullscreen, etc. |
| 162 | -- |
| 163 | -- Common use cases: |
| 164 | -- - Force floating for certain applications (dialogs, utilities) |
| 165 | -- - Send specific applications to specific workspaces |
| 166 | -- - Configure window behavior based on title or class |
| 167 | |
| 168 | -- Examples (uncomment to use): |
| 169 | oxwm.rule.add({ instance = "chromium", floating = true, tag = 2 }) |
| 170 | oxwm.rule.add({ instance = "helium.AppImage", floating = true, tag = 2 }) |
| 171 | oxwm.rule.add({ instance = "gimp", floating = true}) |
| 172 | -- oxwm.rule.add({ class = "Alacritty", tag = 9, focus = true }) |
| 173 | -- oxwm.rule.add({ class = "firefox", title = "Library", floating = true }) |
| 174 | -- oxwm.rule.add({ class = "firefox", tag = 2 }) |
| 175 | -- oxwm.rule.add({ instance = "mpv", floating = true }) |
| 176 | |
| 177 | -- To find window properties, use xprop and click on the window |
| 178 | -- WM_CLASS(STRING) shows both instance and class (instance, class) |
| 179 | |
| 180 | ------------------------------------------------------------------------------- |
| 181 | -- Status Bar Configuration |
| 182 | ------------------------------------------------------------------------------- |
| 183 | -- Font configuration |
| 184 | oxwm.bar.set_font(bar_font) |
| 185 | |
| 186 | -- Position configuration (top/bottom, top is default) |
| 187 | -- oxwm.bar.set_position("bottom") |
| 188 | |
| 189 | -- Set your blocks here (defined above) |
| 190 | oxwm.bar.set_blocks(blocks) |
| 191 | |
| 192 | -- Bar color schemes (for workspace tag display) |
| 193 | -- Parameters: foreground, background, border |
| 194 | |
| 195 | -- Unoccupied tags |
| 196 | oxwm.bar.set_scheme_normal(colors.fg, colors.bg, colors.grey) |
| 197 | -- Occupied tags |
| 198 | oxwm.bar.set_scheme_occupied(colors.cyan, colors.bg, colors.cyan) |
| 199 | -- Currently selected tag |
| 200 | oxwm.bar.set_scheme_selected(colors.cyan, colors.bg, colors.purple) |
| 201 | -- Urgent tags (windows requesting attention) |
| 202 | oxwm.bar.set_scheme_urgent(colors.red, colors.bg, colors.red) |
| 203 | |
| 204 | -- Hide tags that have no windows and are not selected |
| 205 | -- oxwm.bar.set_hide_vacant_tags(true) |
| 206 | |
| 207 | ------------------------------------------------------------------------------- |
| 208 | -- Keybindings |
| 209 | ------------------------------------------------------------------------------- |
| 210 | -- Keybindings are defined using oxwm.key.bind(modifiers, key, action) |
| 211 | -- Modifiers: {"Mod4"}, {"Mod1"}, {"Shift"}, {"Control"}, or combinations like {"Mod4", "Shift"} |
| 212 | -- Keys: Use uppercase for letters (e.g., "Return", "H", "J", "K", "L") |
| 213 | -- Actions: Functions that return actions (e.g., oxwm.spawn(), oxwm.client.kill()) |
| 214 | -- |
| 215 | -- A list of available keysyms can be found in the X11 keysym definitions. |
| 216 | -- Common keys: Return, Space, Tab, Escape, Backspace, Delete, Left, Right, Up, Down |
| 217 | |
| 218 | -- Basic window management |
| 219 | |
| 220 | oxwm.key.bind({ modkey }, "Return", oxwm.spawn_terminal()) |
| 221 | -- Launch Dmenu |
| 222 | oxwm.key.bind({ modkey }, "D", oxwm.spawn({ "sh", "-c", "dmenu_run -l 10" })) |
| 223 | -- Save screenshot to ~/Downloads |
| 224 | oxwm.key.bind({ modkey }, "S", oxwm.spawn({ "sh", "-c", "maim -s ~/Downloads/screenshot-$(date +%Y%m%d-%H%M%S).png" })) |
| 225 | oxwm.key.bind({ modkey }, "O", oxwm.spawn({ "sh", "-c", "helium.AppImage --no-sandbox" })) |
| 226 | oxwm.key.bind({ modkey }, "W", oxwm.client.kill()) |
| 227 | |
| 228 | -- Keybind overlay - Shows important keybindings on screen |
| 229 | oxwm.key.bind({ modkey, "Shift" }, "Slash", oxwm.show_keybinds()) |
| 230 | |
| 231 | -- Window state toggles |
| 232 | --oxwm.key.bind({ modkey, "Shift" }, "A", oxwm.client.toggle_fullscreen()) |
| 233 | oxwm.key.bind({ modkey, "Shift" }, "F", oxwm.client.toggle_floating()) |
| 234 | |
| 235 | -- Layout management |
| 236 | oxwm.key.bind({ modkey }, "F", oxwm.layout.set("normie")) |
| 237 | oxwm.key.bind({ modkey }, "C", oxwm.layout.set("tiling")) |
| 238 | -- Cycle through layouts |
| 239 | oxwm.key.bind({ modkey }, "N", oxwm.layout.cycle()) |
| 240 | |
| 241 | -- Master area controls (tiling layout) |
| 242 | |
| 243 | -- Decrease/Increase master area width |
| 244 | oxwm.key.bind({ modkey }, "H", oxwm.set_master_factor(-5)) |
| 245 | oxwm.key.bind({ modkey }, "L", oxwm.set_master_factor(5)) |
| 246 | -- Enable tiled resize mode: Mod+RMB drag adjusts mfact instead of floating |
| 247 | -- oxwm.tiled_resize_mode(true) |
| 248 | -- Increment/Decrement number of master windows |
| 249 | oxwm.key.bind({ modkey }, "I", oxwm.inc_num_master(1)) |
| 250 | oxwm.key.bind({ modkey }, "P", oxwm.inc_num_master(-1)) |
| 251 | |
| 252 | -- Gaps toggle |
| 253 | oxwm.key.bind({ modkey }, "A", oxwm.toggle_gaps()) |
| 254 | -- Bar toggle |
| 255 | oxwm.key.bind({ modkey }, "B", oxwm.toggle_bar()) |
| 256 | |
| 257 | -- Window manager controls |
| 258 | oxwm.key.bind({ modkey, "Shift" }, "Q", oxwm.quit()) |
| 259 | oxwm.key.bind({ modkey, "Shift" }, "R", oxwm.restart()) |
| 260 | |
| 261 | -- Focus movement [1 for up in the stack, -1 for down] |
| 262 | oxwm.key.bind({ modkey }, "J", oxwm.client.focus_stack(1)) |
| 263 | oxwm.key.bind({ modkey }, "K", oxwm.client.focus_stack(-1)) |
| 264 | |
| 265 | -- Window movement (swap position in stack) |
| 266 | oxwm.key.bind({ modkey, "Shift" }, "J", oxwm.client.move_stack(1)) |
| 267 | oxwm.key.bind({ modkey, "Shift" }, "K", oxwm.client.move_stack(-1)) |
| 268 | |
| 269 | -- Multi-monitor support |
| 270 | |
| 271 | -- Focus next/previous Monitors |
| 272 | oxwm.key.bind({ modkey }, "Comma", oxwm.monitor.focus(-1)) |
| 273 | oxwm.key.bind({ modkey }, "Period", oxwm.monitor.focus(1)) |
| 274 | -- Move window to next/previous Monitors |
| 275 | oxwm.key.bind({ modkey, "Shift" }, "Comma", oxwm.monitor.tag(-1)) |
| 276 | oxwm.key.bind({ modkey, "Shift" }, "Period", oxwm.monitor.tag(1)) |
| 277 | |
| 278 | -- Warp the cursor to the focused monitor when switching monitors |
| 279 | -- oxwm.monitor.warp_cursor(true) |
| 280 | -- Warp the cursor along when sending a window to another monitor |
| 281 | -- oxwm.monitor.warp_cursor_on_send(true) |
| 282 | |
| 283 | -- Workspace (tag) navigation |
| 284 | -- Switch to workspace N (tags are 0-indexed, so tag "1" is index 0) |
| 285 | oxwm.key.bind({ modkey }, "1", oxwm.tag.view(0)) |
| 286 | oxwm.key.bind({ modkey }, "2", oxwm.tag.view(1)) |
| 287 | oxwm.key.bind({ modkey }, "3", oxwm.tag.view(2)) |
| 288 | oxwm.key.bind({ modkey }, "4", oxwm.tag.view(3)) |
| 289 | oxwm.key.bind({ modkey }, "5", oxwm.tag.view(4)) |
| 290 | oxwm.key.bind({ modkey }, "6", oxwm.tag.view(5)) |
| 291 | oxwm.key.bind({ modkey }, "7", oxwm.tag.view(6)) |
| 292 | oxwm.key.bind({ modkey }, "8", oxwm.tag.view(7)) |
| 293 | oxwm.key.bind({ modkey }, "9", oxwm.tag.view(8)) |
| 294 | -- Tags 10-12 (opt-in): set 12 tags above, then pick keys you like and uncomment. |
| 295 | -- oxwm.key.bind({ modkey }, "0", oxwm.tag.view(9)) |
| 296 | -- oxwm.key.bind({ modkey }, "minus", oxwm.tag.view(10)) |
| 297 | -- oxwm.key.bind({ modkey }, "equal", oxwm.tag.view(11)) |
| 298 | |
| 299 | -- Move focused window to workspace N |
| 300 | oxwm.key.bind({ modkey, "Shift" }, "1", oxwm.tag.move_to(0)) |
| 301 | oxwm.key.bind({ modkey, "Shift" }, "2", oxwm.tag.move_to(1)) |
| 302 | oxwm.key.bind({ modkey, "Shift" }, "3", oxwm.tag.move_to(2)) |
| 303 | oxwm.key.bind({ modkey, "Shift" }, "4", oxwm.tag.move_to(3)) |
| 304 | oxwm.key.bind({ modkey, "Shift" }, "5", oxwm.tag.move_to(4)) |
| 305 | oxwm.key.bind({ modkey, "Shift" }, "6", oxwm.tag.move_to(5)) |
| 306 | oxwm.key.bind({ modkey, "Shift" }, "7", oxwm.tag.move_to(6)) |
| 307 | oxwm.key.bind({ modkey, "Shift" }, "8", oxwm.tag.move_to(7)) |
| 308 | oxwm.key.bind({ modkey, "Shift" }, "9", oxwm.tag.move_to(8)) |
| 309 | -- oxwm.key.bind({ modkey, "Shift" }, "0", oxwm.tag.move_to(9)) |
| 310 | -- oxwm.key.bind({ modkey, "Shift" }, "minus", oxwm.tag.move_to(10)) |
| 311 | -- oxwm.key.bind({ modkey, "Shift" }, "equal", oxwm.tag.move_to(11)) |
| 312 | |
| 313 | -- Combo view (view multiple tags at once) {argos_nothing} |
| 314 | -- Example: Mod+Ctrl+2 while on tag 1 will show BOTH tags 1 and 2 |
| 315 | oxwm.key.bind({ modkey, "Control" }, "1", oxwm.tag.toggleview(0)) |
| 316 | oxwm.key.bind({ modkey, "Control" }, "2", oxwm.tag.toggleview(1)) |
| 317 | oxwm.key.bind({ modkey, "Control" }, "3", oxwm.tag.toggleview(2)) |
| 318 | oxwm.key.bind({ modkey, "Control" }, "4", oxwm.tag.toggleview(3)) |
| 319 | oxwm.key.bind({ modkey, "Control" }, "5", oxwm.tag.toggleview(4)) |
| 320 | oxwm.key.bind({ modkey, "Control" }, "6", oxwm.tag.toggleview(5)) |
| 321 | oxwm.key.bind({ modkey, "Control" }, "7", oxwm.tag.toggleview(6)) |
| 322 | oxwm.key.bind({ modkey, "Control" }, "8", oxwm.tag.toggleview(7)) |
| 323 | oxwm.key.bind({ modkey, "Control" }, "9", oxwm.tag.toggleview(8)) |
| 324 | -- oxwm.key.bind({ modkey, "Control" }, "0", oxwm.tag.toggleview(9)) |
| 325 | -- oxwm.key.bind({ modkey, "Control" }, "minus", oxwm.tag.toggleview(10)) |
| 326 | -- oxwm.key.bind({ modkey, "Control" }, "equal", oxwm.tag.toggleview(11)) |
| 327 | |
| 328 | -- Multi tag (window on multiple tags) |
| 329 | -- Example: Mod+Ctrl+Shift+2 puts focused window on BOTH current tag and tag 2 |
| 330 | oxwm.key.bind({ modkey, "Control", "Shift" }, "1", oxwm.tag.toggletag(0)) |
| 331 | oxwm.key.bind({ modkey, "Control", "Shift" }, "2", oxwm.tag.toggletag(1)) |
| 332 | oxwm.key.bind({ modkey, "Control", "Shift" }, "3", oxwm.tag.toggletag(2)) |
| 333 | oxwm.key.bind({ modkey, "Control", "Shift" }, "4", oxwm.tag.toggletag(3)) |
| 334 | oxwm.key.bind({ modkey, "Control", "Shift" }, "5", oxwm.tag.toggletag(4)) |
| 335 | oxwm.key.bind({ modkey, "Control", "Shift" }, "6", oxwm.tag.toggletag(5)) |
| 336 | oxwm.key.bind({ modkey, "Control", "Shift" }, "7", oxwm.tag.toggletag(6)) |
| 337 | oxwm.key.bind({ modkey, "Control", "Shift" }, "8", oxwm.tag.toggletag(7)) |
| 338 | oxwm.key.bind({ modkey, "Control", "Shift" }, "9", oxwm.tag.toggletag(8)) |
| 339 | -- oxwm.key.bind({ modkey, "Control", "Shift" }, "0", oxwm.tag.toggletag(9)) |
| 340 | -- oxwm.key.bind({ modkey, "Control", "Shift" }, "minus", oxwm.tag.toggletag(10)) |
| 341 | -- oxwm.key.bind({ modkey, "Control", "Shift" }, "equal", oxwm.tag.toggletag(11)) |
| 342 | |
| 343 | ------------------------------------------------------------------------------- |
| 344 | -- Advanced: Keychords |
| 345 | ------------------------------------------------------------------------------- |
| 346 | -- Keychords allow you to bind multiple-key sequences (like Emacs or Vim) |
| 347 | -- Format: {{modifiers}, key1}, {{modifiers}, key2}, ... |
| 348 | -- Example: Press Mod4+Space, then release and press T to spawn a terminal |
| 349 | oxwm.key.chord({ |
| 350 | { { modkey }, "Space" }, |
| 351 | { {}, "T" } |
| 352 | }, oxwm.spawn_terminal()) |
| 353 | |
| 354 | ------------------------------------------------------------------------------- |
| 355 | -- Autostart |
| 356 | ------------------------------------------------------------------------------- |
| 357 | -- Commands to run once when OXWM starts |
| 358 | -- Uncomment and modify these examples, or add your own |
| 359 | |
| 360 | -- oxwm.autostart("picom") |
| 361 | -- oxwm.autostart("feh --bg-scale ~/wallpaper.jpg") |
| 362 | -- oxwm.autostart("dunst") |
| 363 | -- oxwm.autostart("nm-applet") |