tony / oxwm

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