tony / oxwm

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