tony / oxwm

Branch: b419fcd
Switch branches/tags
master
tonybanters updated for scrolling with gestures, and size of windows in scrolling layout. b419fcd 2026-09-20
384 lines · 16.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 -- Scrolling layout: windows sit side by side in an infinite strip (like niri)
133 -- Widths at or below 1 are a proportion of the screen, larger values are pixels
134 -- oxwm.scroll.set_default_width(0.5)
135 -- oxwm.scroll.set_width_presets({ 1 / 3, 1 / 2, 2 / 3 })
136 -- Three-finger touchpad swipes scroll the strip and snap to the nearest window
137 -- (needs read access to /dev/input, usually the "input" group)
138 -- oxwm.scroll.set_gesture_enabled(true)
139 -- oxwm.scroll.set_gesture_fingers(3)
140 -- oxwm.scroll.set_gesture_speed(2.0)
141 -- oxwm.scroll.set_gesture_natural(false)
142
143 -- Set the default attach method, similar to the patches from dwm
144 -- Available methods: "aside" (default), "top", "bottom", "above", "below"
145 -- For example "above" makes new clients appear above the currently selected one
146 oxwm.set_attach_method("aside")
147
148 -------------------------------------------------------------------------------
149 -- Appearance
150 -------------------------------------------------------------------------------
151 -- Border configuration
152
153 -- Width in pixels
154 oxwm.border.set_width(2)
155 -- Color of focused window border
156 oxwm.border.set_focused_color(colors.blue)
157 -- Color of unfocused window borders
158 oxwm.border.set_unfocused_color(colors.grey)
159
160 -- Where floating windows spawn: "top-left", "top-center", "top-right",
161 -- "center-left", "center", "center-right", "bottom-left", "bottom-center", "bottom-right"
162 oxwm.set_floating_position("center")
163
164 -- Smart Enabled = No border if 1 window
165 oxwm.gaps.set_smart(true)
166 -- Inner gaps (horizontal, vertical) in pixels
167 oxwm.gaps.set_inner(5, 5)
168 -- Outer gaps (horizontal, vertical) in pixels
169 oxwm.gaps.set_outer(5, 5)
170
171 -------------------------------------------------------------------------------
172 -- Window Rules
173 -------------------------------------------------------------------------------
174 -- Rules allow you to automatically configure windows based on their properties
175 -- You can match windows by class, instance, title, or role
176 -- Available properties: floating, tag, fullscreen, etc.
177 --
178 -- Common use cases:
179 -- - Force floating for certain applications (dialogs, utilities)
180 -- - Send specific applications to specific workspaces
181 -- - Configure window behavior based on title or class
182
183 -- Examples (uncomment to use):
184 oxwm.rule.add({ instance = "gimp", floating = true })
185 -- oxwm.rule.add({ class = "Alacritty", tag = 9, focus = true })
186 -- oxwm.rule.add({ class = "firefox", title = "Library", floating = true })
187 -- oxwm.rule.add({ class = "firefox", tag = 2 })
188 -- oxwm.rule.add({ instance = "mpv", floating = true })
189
190 -- To find window properties, use xprop and click on the window
191 -- WM_CLASS(STRING) shows both instance and class (instance, class)
192
193 -------------------------------------------------------------------------------
194 -- Status Bar Configuration
195 -------------------------------------------------------------------------------
196 -- Font configuration
197 oxwm.bar.set_font(bar_font)
198
199 -- Position configuration (top/bottom, top is default)
200 -- oxwm.bar.set_position("bottom")
201
202 -- Set your blocks here (defined above)
203 oxwm.bar.set_blocks(blocks)
204
205 -- Bar color schemes (for workspace tag display)
206 -- Parameters: foreground, background, border
207
208 -- Unoccupied tags
209 oxwm.bar.set_scheme_normal(colors.fg, colors.bg, "#444444")
210 -- Occupied tags
211 oxwm.bar.set_scheme_occupied(colors.cyan, colors.bg, colors.cyan)
212 -- Currently selected tag
213 oxwm.bar.set_scheme_selected(colors.cyan, colors.bg, colors.purple)
214 -- Urgent tags (windows requesting attention)
215 oxwm.bar.set_scheme_urgent(colors.red, colors.bg, colors.red)
216
217 -- Hide tags that have no windows and are not selected
218 -- oxwm.bar.set_hide_vacant_tags(true)
219
220 -------------------------------------------------------------------------------
221 -- Keybindings
222 -------------------------------------------------------------------------------
223 -- Keybindings are defined using oxwm.key.bind(modifiers, key, action)
224 -- Modifiers: {"Mod4"}, {"Mod1"}, {"Shift"}, {"Control"}, or combinations like {"Mod4", "Shift"}
225 -- Keys: Use uppercase for letters (e.g., "Return", "H", "J", "K", "L")
226 -- Actions: Functions that return actions (e.g., oxwm.spawn(), oxwm.client.kill())
227 --
228 -- A list of available keysyms can be found in the X11 keysym definitions.
229 -- Common keys: Return, Space, Tab, Escape, Backspace, Delete, Left, Right, Up, Down
230
231 -- Basic window management
232
233 oxwm.key.bind({ modkey }, "Return", oxwm.spawn_terminal())
234 -- Launch Dmenu
235 oxwm.key.bind({ modkey }, "D", oxwm.spawn({ "sh", "-c", "dmenu_run -l 10" }))
236 -- Copy screenshot to clipboard
237 oxwm.key.bind({ modkey }, "S", oxwm.spawn({ "sh", "-c", "maim -s | xclip -selection clipboard -t image/png" }))
238 oxwm.key.bind({ modkey }, "Q", oxwm.client.kill())
239
240 -- Keybind overlay - Shows important keybindings on screen
241 oxwm.key.bind({ modkey, "Shift" }, "Slash", oxwm.show_keybinds())
242
243 -- Window state toggles
244 oxwm.key.bind({ modkey, "Shift" }, "F", oxwm.client.toggle_fullscreen())
245 oxwm.key.bind({ modkey, "Shift" }, "Space", oxwm.client.toggle_floating())
246
247 -- Layout management
248 oxwm.key.bind({ modkey }, "F", oxwm.layout.set("normie"))
249 oxwm.key.bind({ modkey }, "C", oxwm.layout.set("tiling"))
250 -- Cycle through layouts
251 oxwm.key.bind({ modkey }, "N", oxwm.layout.cycle())
252
253 -- Scrolling layout controls
254 -- oxwm.key.bind({ modkey }, "G", oxwm.layout.set("scrolling"))
255 -- oxwm.key.bind({ modkey }, "Left", oxwm.layout.scroll_left())
256 -- oxwm.key.bind({ modkey }, "Right", oxwm.layout.scroll_right())
257 -- oxwm.key.bind({ modkey }, "R", oxwm.layout.cycle_width(1))
258 -- oxwm.key.bind({ modkey, "Shift" }, "R", oxwm.layout.cycle_width(-1))
259 -- oxwm.key.bind({ modkey }, "M", oxwm.layout.set_width(1))
260 -- In the scrolling layout set_master_factor resizes the focused window instead
261
262 -- Master area controls (tiling layout)
263
264 -- Decrease/Increase master area width
265 oxwm.key.bind({ modkey }, "H", oxwm.set_master_factor(-5))
266 oxwm.key.bind({ modkey }, "L", oxwm.set_master_factor(5))
267 -- Enable tiled resize mode: Mod+RMB drag adjusts mfact instead of floating
268 -- oxwm.tiled_resize_mode(true)
269 -- Increment/Decrement number of master windows
270 oxwm.key.bind({ modkey }, "I", oxwm.inc_num_master(1))
271 oxwm.key.bind({ modkey }, "P", oxwm.inc_num_master(-1))
272
273 -- Gaps toggle
274 oxwm.key.bind({ modkey }, "A", oxwm.toggle_gaps())
275 -- Bar toggle
276 oxwm.key.bind({ modkey }, "B", oxwm.toggle_bar())
277
278 -- Window manager controls
279 oxwm.key.bind({ modkey, "Shift" }, "Q", oxwm.quit())
280 oxwm.key.bind({ modkey, "Shift" }, "R", oxwm.restart())
281
282 -- Focus movement [1 for up in the stack, -1 for down]
283 oxwm.key.bind({ modkey }, "J", oxwm.client.focus_stack(1))
284 oxwm.key.bind({ modkey }, "K", oxwm.client.focus_stack(-1))
285
286 -- Window movement (swap position in stack)
287 oxwm.key.bind({ modkey, "Shift" }, "J", oxwm.client.move_stack(1))
288 oxwm.key.bind({ modkey, "Shift" }, "K", oxwm.client.move_stack(-1))
289
290 -- Multi-monitor support
291
292 -- Focus next/previous Monitors
293 oxwm.key.bind({ modkey }, "Comma", oxwm.monitor.focus(-1))
294 oxwm.key.bind({ modkey }, "Period", oxwm.monitor.focus(1))
295 -- Move window to next/previous Monitors
296 oxwm.key.bind({ modkey, "Shift" }, "Comma", oxwm.monitor.tag(-1))
297 oxwm.key.bind({ modkey, "Shift" }, "Period", oxwm.monitor.tag(1))
298
299 -- Warp the cursor to the focused monitor when switching monitors
300 -- oxwm.monitor.warp_cursor(true)
301 -- Warp the cursor along when sending a window to another monitor
302 -- oxwm.monitor.warp_cursor_on_send(true)
303
304 -- Workspace (tag) navigation
305 -- Switch to workspace N (tags are 0-indexed, so tag "1" is index 0)
306 oxwm.key.bind({ modkey }, "1", oxwm.tag.view(0))
307 oxwm.key.bind({ modkey }, "2", oxwm.tag.view(1))
308 oxwm.key.bind({ modkey }, "3", oxwm.tag.view(2))
309 oxwm.key.bind({ modkey }, "4", oxwm.tag.view(3))
310 oxwm.key.bind({ modkey }, "5", oxwm.tag.view(4))
311 oxwm.key.bind({ modkey }, "6", oxwm.tag.view(5))
312 oxwm.key.bind({ modkey }, "7", oxwm.tag.view(6))
313 oxwm.key.bind({ modkey }, "8", oxwm.tag.view(7))
314 oxwm.key.bind({ modkey }, "9", oxwm.tag.view(8))
315 -- Tags 10-12 (opt-in): set 12 tags above, then pick keys you like and uncomment.
316 -- oxwm.key.bind({ modkey }, "0", oxwm.tag.view(9))
317 -- oxwm.key.bind({ modkey }, "minus", oxwm.tag.view(10))
318 -- oxwm.key.bind({ modkey }, "equal", oxwm.tag.view(11))
319
320 -- Move focused window to workspace N
321 oxwm.key.bind({ modkey, "Shift" }, "1", oxwm.tag.move_to(0))
322 oxwm.key.bind({ modkey, "Shift" }, "2", oxwm.tag.move_to(1))
323 oxwm.key.bind({ modkey, "Shift" }, "3", oxwm.tag.move_to(2))
324 oxwm.key.bind({ modkey, "Shift" }, "4", oxwm.tag.move_to(3))
325 oxwm.key.bind({ modkey, "Shift" }, "5", oxwm.tag.move_to(4))
326 oxwm.key.bind({ modkey, "Shift" }, "6", oxwm.tag.move_to(5))
327 oxwm.key.bind({ modkey, "Shift" }, "7", oxwm.tag.move_to(6))
328 oxwm.key.bind({ modkey, "Shift" }, "8", oxwm.tag.move_to(7))
329 oxwm.key.bind({ modkey, "Shift" }, "9", oxwm.tag.move_to(8))
330 -- oxwm.key.bind({ modkey, "Shift" }, "0", oxwm.tag.move_to(9))
331 -- oxwm.key.bind({ modkey, "Shift" }, "minus", oxwm.tag.move_to(10))
332 -- oxwm.key.bind({ modkey, "Shift" }, "equal", oxwm.tag.move_to(11))
333
334 -- Combo view (view multiple tags at once) {argos_nothing}
335 -- Example: Mod+Ctrl+2 while on tag 1 will show BOTH tags 1 and 2
336 oxwm.key.bind({ modkey, "Control" }, "1", oxwm.tag.toggleview(0))
337 oxwm.key.bind({ modkey, "Control" }, "2", oxwm.tag.toggleview(1))
338 oxwm.key.bind({ modkey, "Control" }, "3", oxwm.tag.toggleview(2))
339 oxwm.key.bind({ modkey, "Control" }, "4", oxwm.tag.toggleview(3))
340 oxwm.key.bind({ modkey, "Control" }, "5", oxwm.tag.toggleview(4))
341 oxwm.key.bind({ modkey, "Control" }, "6", oxwm.tag.toggleview(5))
342 oxwm.key.bind({ modkey, "Control" }, "7", oxwm.tag.toggleview(6))
343 oxwm.key.bind({ modkey, "Control" }, "8", oxwm.tag.toggleview(7))
344 oxwm.key.bind({ modkey, "Control" }, "9", oxwm.tag.toggleview(8))
345 -- oxwm.key.bind({ modkey, "Control" }, "0", oxwm.tag.toggleview(9))
346 -- oxwm.key.bind({ modkey, "Control" }, "minus", oxwm.tag.toggleview(10))
347 -- oxwm.key.bind({ modkey, "Control" }, "equal", oxwm.tag.toggleview(11))
348
349 -- Multi tag (window on multiple tags)
350 -- Example: Mod+Ctrl+Shift+2 puts focused window on BOTH current tag and tag 2
351 oxwm.key.bind({ modkey, "Control", "Shift" }, "1", oxwm.tag.toggletag(0))
352 oxwm.key.bind({ modkey, "Control", "Shift" }, "2", oxwm.tag.toggletag(1))
353 oxwm.key.bind({ modkey, "Control", "Shift" }, "3", oxwm.tag.toggletag(2))
354 oxwm.key.bind({ modkey, "Control", "Shift" }, "4", oxwm.tag.toggletag(3))
355 oxwm.key.bind({ modkey, "Control", "Shift" }, "5", oxwm.tag.toggletag(4))
356 oxwm.key.bind({ modkey, "Control", "Shift" }, "6", oxwm.tag.toggletag(5))
357 oxwm.key.bind({ modkey, "Control", "Shift" }, "7", oxwm.tag.toggletag(6))
358 oxwm.key.bind({ modkey, "Control", "Shift" }, "8", oxwm.tag.toggletag(7))
359 oxwm.key.bind({ modkey, "Control", "Shift" }, "9", oxwm.tag.toggletag(8))
360 -- oxwm.key.bind({ modkey, "Control", "Shift" }, "0", oxwm.tag.toggletag(9))
361 -- oxwm.key.bind({ modkey, "Control", "Shift" }, "minus", oxwm.tag.toggletag(10))
362 -- oxwm.key.bind({ modkey, "Control", "Shift" }, "equal", oxwm.tag.toggletag(11))
363
364 -------------------------------------------------------------------------------
365 -- Advanced: Keychords
366 -------------------------------------------------------------------------------
367 -- Keychords allow you to bind multiple-key sequences (like Emacs or Vim)
368 -- Format: {{modifiers}, key1}, {{modifiers}, key2}, ...
369 -- Example: Press Mod4+Space, then release and press T to spawn a terminal
370 oxwm.key.chord({
371 { { modkey }, "Space" },
372 { {}, "T" }
373 }, oxwm.spawn_terminal())
374
375 -------------------------------------------------------------------------------
376 -- Autostart
377 -------------------------------------------------------------------------------
378 -- Commands to run once when OXWM starts
379 -- Uncomment and modify these examples, or add your own
380
381 -- oxwm.autostart("picom")
382 -- oxwm.autostart("feh --bg-scale ~/wallpaper.jpg")
383 -- oxwm.autostart("dunst")
384 -- oxwm.autostart("nm-applet")