| 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 (defualts to alacritty) |
| 25 | local terminal = "alacritty" |
| 26 | |
| 27 | -- Color palette - customize these to match your theme |
| 28 | local colors = { |
| 29 | fg = "#bbbbbb", |
| 30 | red = "#f7768e", |
| 31 | bg = "#1a1b26", |
| 32 | cyan = "#0db9d7", |
| 33 | green = "#9ece6a", |
| 34 | lavender = "#a9b1d6", |
| 35 | light_blue = "#7aa2f7", |
| 36 | grey = "#bbbbbb", |
| 37 | blue = "#6dade3", |
| 38 | purple = "#ad8ee6", |
| 39 | } |
| 40 | |
| 41 | -- Workspace tags - can be numbers, names, or icons (requires a Nerd Font) |
| 42 | local tags = { "1", "2", "3", "4", "5", "6", "7", "8", "9" } |
| 43 | -- local tags = { "", "", "", "", "", "", "", "", "" } -- Example of nerd font icon tags |
| 44 | |
| 45 | -- Font for the status bar (use "fc-list" to see available fonts) |
| 46 | local bar_font = "monospace:style=Bold:size=10" |
| 47 | |
| 48 | -- Define your blocks |
| 49 | -- Similar to widgets in qtile, or dwmblocks |
| 50 | local blocks = { |
| 51 | oxwm.bar.block.ram({ |
| 52 | format = "Ram: {used}/{total} GB", |
| 53 | interval = 5, |
| 54 | color = colors.light_blue, |
| 55 | underline = true, |
| 56 | }), |
| 57 | oxwm.bar.block.static({ |
| 58 | format = "{}", |
| 59 | text = " │ ", |
| 60 | interval = 999999999, |
| 61 | color = colors.lavender, |
| 62 | underline = false, |
| 63 | }), |
| 64 | oxwm.bar.block.shell({ |
| 65 | format = "Kernel: {}", |
| 66 | command = "uname -r", |
| 67 | interval = 999999999, |
| 68 | color = colors.red, |
| 69 | underline = true, |
| 70 | }), |
| 71 | oxwm.bar.block.static({ |
| 72 | format = "{}", |
| 73 | text = " │ ", |
| 74 | interval = 999999999, |
| 75 | color = colors.lavender, |
| 76 | underline = false, |
| 77 | }), |
| 78 | oxwm.bar.block.datetime({ |
| 79 | format = "{}", |
| 80 | date_format = "%a, %b %d - %-I:%M %P", |
| 81 | interval = 1, |
| 82 | color = colors.cyan, |
| 83 | underline = true, |
| 84 | }), |
| 85 | -- Uncomment to add battery status (useful for laptops) |
| 86 | -- oxwm.bar.block.battery({ |
| 87 | -- format = "Bat: {}%", |
| 88 | -- charging = "⚡ Bat: {}%", |
| 89 | -- discharging = "- Bat: {}%", |
| 90 | -- full = "✓ Bat: {}%", |
| 91 | -- interval = 30, |
| 92 | -- color = colors.green, |
| 93 | -- underline = true, |
| 94 | -- }), |
| 95 | }; |
| 96 | |
| 97 | ------------------------------------------------------------------------------- |
| 98 | -- Basic Settings |
| 99 | ------------------------------------------------------------------------------- |
| 100 | oxwm.set_terminal(terminal) |
| 101 | oxwm.set_modkey(modkey) -- This is for Mod + mouse binds, such as drag/resize |
| 102 | oxwm.set_tags(tags) |
| 103 | |
| 104 | ------------------------------------------------------------------------------- |
| 105 | -- Layouts |
| 106 | ------------------------------------------------------------------------------- |
| 107 | -- Set custom symbols for layouts (displayed in the status bar) |
| 108 | -- Available layouts: "tiling", "normie" (floating), "grid", "monocle", "tabbed" |
| 109 | oxwm.set_layout_symbol("tiling", "[T]") |
| 110 | oxwm.set_layout_symbol("normie", "[F]") |
| 111 | oxwm.set_layout_symbol("tabbed", "[=]") |
| 112 | |
| 113 | ------------------------------------------------------------------------------- |
| 114 | -- Appearance |
| 115 | ------------------------------------------------------------------------------- |
| 116 | -- Border configuration |
| 117 | oxwm.border.set_width(2) -- Width in pixels |
| 118 | oxwm.border.set_focused_color(colors.blue) -- Color of focused window border |
| 119 | oxwm.border.set_unfocused_color(colors.grey) -- Color of unfocused window borders |
| 120 | |
| 121 | -- Gap configuration (space between windows and screen edges) |
| 122 | oxwm.gaps.set_enabled(true) -- Enable or disable gaps |
| 123 | oxwm.gaps.set_inner(5, 5) -- Inner gaps (horizontal, vertical) in pixels |
| 124 | oxwm.gaps.set_outer(5, 5) -- Outer gaps (horizontal, vertical) in pixels |
| 125 | |
| 126 | ------------------------------------------------------------------------------- |
| 127 | -- Window Rules |
| 128 | ------------------------------------------------------------------------------- |
| 129 | -- Rules allow you to automatically configure windows based on their properties |
| 130 | -- You can match windows by class, instance, title, or role |
| 131 | -- Available properties: floating, tag, fullscreen, etc. |
| 132 | -- |
| 133 | -- Common use cases: |
| 134 | -- - Force floating for certain applications (dialogs, utilities) |
| 135 | -- - Send specific applications to specific workspaces |
| 136 | -- - Configure window behavior based on title or class |
| 137 | |
| 138 | -- Examples (uncomment to use): |
| 139 | -- oxwm.rule.add({ class = "firefox", title = "Library", floating = true }) -- Make Firefox Library window floating |
| 140 | -- oxwm.rule.add({ instance = "gimp", tag = 5 }) -- Send GIMP to workspace 6 (0-indexed) |
| 141 | -- oxwm.rule.add({ instance = "mpv", floating = true }) -- Make mpv always float |
| 142 | |
| 143 | -- To find window properties, use xprop and click on the window |
| 144 | -- WM_CLASS(STRING) shows both instance and class (instance, class) |
| 145 | |
| 146 | ------------------------------------------------------------------------------- |
| 147 | -- Status Bar Configuration |
| 148 | ------------------------------------------------------------------------------- |
| 149 | -- Font configuration |
| 150 | oxwm.bar.set_font(bar_font) |
| 151 | |
| 152 | -- Set your blocks here (defined above) |
| 153 | oxwm.bar.set_blocks(blocks) |
| 154 | |
| 155 | -- Bar color schemes (for workspace tag display) |
| 156 | -- Parameters: foreground, background, border |
| 157 | oxwm.bar.set_scheme_normal(colors.fg, colors.bg, "#444444") -- Unoccupied tags |
| 158 | oxwm.bar.set_scheme_occupied(colors.cyan, colors.bg, colors.cyan) -- Occupied tags |
| 159 | oxwm.bar.set_scheme_selected(colors.cyan, colors.bg, colors.purple) -- Currently selected tag |
| 160 | |
| 161 | ------------------------------------------------------------------------------- |
| 162 | -- Keybindings |
| 163 | ------------------------------------------------------------------------------- |
| 164 | -- Keybindings are defined using oxwm.key.bind(modifiers, key, action) |
| 165 | -- Modifiers: {"Mod4"}, {"Mod1"}, {"Shift"}, {"Control"}, or combinations like {"Mod4", "Shift"} |
| 166 | -- Keys: Use uppercase for letters (e.g., "Return", "H", "J", "K", "L") |
| 167 | -- Actions: Functions that return actions (e.g., oxwm.spawn(), oxwm.client.kill()) |
| 168 | -- |
| 169 | -- A list of available keysyms can be found in the X11 keysym definitions. |
| 170 | -- Common keys: Return, Space, Tab, Escape, Backspace, Delete, Left, Right, Up, Down |
| 171 | |
| 172 | -- Basic window management |
| 173 | oxwm.key.bind({ modkey }, "Return", oxwm.spawn_terminal()) -- Spawn terminal |
| 174 | oxwm.key.bind({ modkey }, "D", oxwm.spawn({ "sh", "-c", "dmenu_run -l 10" })) -- Application launcher |
| 175 | oxwm.key.bind({ modkey }, "S", oxwm.spawn({ "sh", "-c", "maim -s | xclip -selection clipboard -t image/png" })) -- Screenshot selection |
| 176 | oxwm.key.bind({ modkey }, "Q", oxwm.client.kill()) -- Close focused window |
| 177 | |
| 178 | -- Keybind overlay - Shows important keybindings on screen |
| 179 | oxwm.key.bind({ modkey, "Shift" }, "Slash", oxwm.show_keybinds()) |
| 180 | |
| 181 | -- Window state toggles |
| 182 | oxwm.key.bind({ modkey, "Shift" }, "F", oxwm.client.toggle_fullscreen()) -- Toggle fullscreen |
| 183 | oxwm.key.bind({ modkey, "Shift" }, "Space", oxwm.client.toggle_floating()) -- Toggle floating mode |
| 184 | |
| 185 | -- Layout management |
| 186 | oxwm.key.bind({ modkey }, "F", oxwm.layout.set("normie")) -- Set floating layout |
| 187 | oxwm.key.bind({ modkey }, "C", oxwm.layout.set("tiling")) -- Set tiling layout |
| 188 | oxwm.key.bind({ modkey }, "N", oxwm.layout.cycle()) -- Cycle through layouts |
| 189 | |
| 190 | -- Master area controls (tiling layout) |
| 191 | oxwm.key.bind({ modkey }, "H", oxwm.set_master_factor(-5)) -- Decrease master area width |
| 192 | oxwm.key.bind({ modkey }, "L", oxwm.set_master_factor(5)) -- Increase master area width |
| 193 | oxwm.key.bind({ modkey }, "I", oxwm.inc_num_master(1)) -- Increment number of master windows |
| 194 | oxwm.key.bind({ modkey }, "P", oxwm.inc_num_master(-1)) -- Decrement number of master windows |
| 195 | |
| 196 | -- Gaps toggle |
| 197 | oxwm.key.bind({ modkey }, "A", oxwm.toggle_gaps()) -- Toggle gaps on/off |
| 198 | |
| 199 | -- Window manager controls |
| 200 | oxwm.key.bind({ modkey, "Shift" }, "Q", oxwm.quit()) -- Quit OXWM |
| 201 | oxwm.key.bind({ modkey, "Shift" }, "R", oxwm.restart()) -- Restart OXWM (reloads config) |
| 202 | |
| 203 | -- Focus movement (stack cycling) |
| 204 | oxwm.key.bind({ modkey }, "J", oxwm.client.focus_stack(1)) -- Focus next window in stack |
| 205 | oxwm.key.bind({ modkey }, "K", oxwm.client.focus_stack(-1)) -- Focus previous window in stack |
| 206 | |
| 207 | -- Window movement (swap position in stack) |
| 208 | oxwm.key.bind({ modkey, "Shift" }, "J", oxwm.client.move_stack(1)) -- Move window down in stack |
| 209 | oxwm.key.bind({ modkey, "Shift" }, "K", oxwm.client.move_stack(-1)) -- Move window up in stack |
| 210 | |
| 211 | -- Multi-monitor support |
| 212 | oxwm.key.bind({ modkey }, "Comma", oxwm.monitor.focus(-1)) -- Focus previous monitor |
| 213 | oxwm.key.bind({ modkey }, "Period", oxwm.monitor.focus(1)) -- Focus next monitor |
| 214 | oxwm.key.bind({ modkey, "Shift" }, "Comma", oxwm.monitor.tag(-1)) -- Send window to previous monitor |
| 215 | oxwm.key.bind({ modkey, "Shift" }, "Period", oxwm.monitor.tag(1)) -- Send window to next monitor |
| 216 | |
| 217 | -- Workspace (tag) navigation |
| 218 | -- Switch to workspace N (tags are 0-indexed, so tag "1" is index 0) |
| 219 | oxwm.key.bind({ modkey }, "1", oxwm.tag.view(0)) |
| 220 | oxwm.key.bind({ modkey }, "2", oxwm.tag.view(1)) |
| 221 | oxwm.key.bind({ modkey }, "3", oxwm.tag.view(2)) |
| 222 | oxwm.key.bind({ modkey }, "4", oxwm.tag.view(3)) |
| 223 | oxwm.key.bind({ modkey }, "5", oxwm.tag.view(4)) |
| 224 | oxwm.key.bind({ modkey }, "6", oxwm.tag.view(5)) |
| 225 | oxwm.key.bind({ modkey }, "7", oxwm.tag.view(6)) |
| 226 | oxwm.key.bind({ modkey }, "8", oxwm.tag.view(7)) |
| 227 | oxwm.key.bind({ modkey }, "9", oxwm.tag.view(8)) |
| 228 | |
| 229 | -- Move focused window to workspace N |
| 230 | oxwm.key.bind({ modkey, "Shift" }, "1", oxwm.tag.move_to(0)) |
| 231 | oxwm.key.bind({ modkey, "Shift" }, "2", oxwm.tag.move_to(1)) |
| 232 | oxwm.key.bind({ modkey, "Shift" }, "3", oxwm.tag.move_to(2)) |
| 233 | oxwm.key.bind({ modkey, "Shift" }, "4", oxwm.tag.move_to(3)) |
| 234 | oxwm.key.bind({ modkey, "Shift" }, "5", oxwm.tag.move_to(4)) |
| 235 | oxwm.key.bind({ modkey, "Shift" }, "6", oxwm.tag.move_to(5)) |
| 236 | oxwm.key.bind({ modkey, "Shift" }, "7", oxwm.tag.move_to(6)) |
| 237 | oxwm.key.bind({ modkey, "Shift" }, "8", oxwm.tag.move_to(7)) |
| 238 | oxwm.key.bind({ modkey, "Shift" }, "9", oxwm.tag.move_to(8)) |
| 239 | |
| 240 | ------------------------------------------------------------------------------- |
| 241 | -- Advanced: Keychords |
| 242 | ------------------------------------------------------------------------------- |
| 243 | -- Keychords allow you to bind multiple-key sequences (like Emacs or Vim) |
| 244 | -- Format: {{modifiers}, key1}, {{modifiers}, key2}, ... |
| 245 | -- Example: Press Mod4+Space, then release and press T to spawn a terminal |
| 246 | oxwm.key.chord({ |
| 247 | { { modkey }, "Space" }, |
| 248 | { {}, "T" } |
| 249 | }, oxwm.spawn_terminal()) |
| 250 | |
| 251 | ------------------------------------------------------------------------------- |
| 252 | -- Autostart |
| 253 | ------------------------------------------------------------------------------- |
| 254 | -- Commands to run once when OXWM starts |
| 255 | -- Uncomment and modify these examples, or add your own |
| 256 | |
| 257 | -- oxwm.autostart("picom") -- Compositor for transparency and effects |
| 258 | -- oxwm.autostart("feh --bg-scale ~/wallpaper.jpg") -- Set wallpaper |
| 259 | -- oxwm.autostart("dunst") -- Notification daemon |
| 260 | -- oxwm.autostart("nm-applet") -- Network manager applet |