tony / oxwm

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