Updated default config to match new functions. Updated oxwm.lua lsp helper file to match new functions. Updated readme to reflect changes. Bumped version to 0.8.0. Added new error modal until 1.0.0 is launched.
Browse files
+1 −1 Cargo.lock
| @@ -291,7 +291,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" | |||
| 291 | 291 | ||
| 292 | [[package]] | 292 | [[package]] |
| 293 | name = "oxwm" | 293 | name = "oxwm" |
| 294 | -version = "0.7.4" | 294 | +version = "0.8.0" |
| 295 | dependencies = [ | 295 | dependencies = [ |
| 296 | "chrono", | 296 | "chrono", |
| 297 | "dirs", | 297 | "dirs", |
+1 −1 Cargo.toml
| @@ -1,6 +1,6 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "oxwm" | 2 | name = "oxwm" |
| 3 | -version = "0.7.4" | 3 | +version = "0.8.0" |
| 4 | edition = "2024" | 4 | edition = "2024" |
| 5 | 5 | ||
| 6 | [lib] | 6 | [lib] |
+132 −79 readme.org
| @@ -11,22 +11,26 @@ | |||
| 11 | - [[#building-from-source][Building from Source]] | 11 | - [[#building-from-source][Building from Source]] |
| 12 | - [[#setting-up-oxwm][Setting up OXWM]] | 12 | - [[#setting-up-oxwm][Setting up OXWM]] |
| 13 | - [[#configuration][Configuration]] | 13 | - [[#configuration][Configuration]] |
| 14 | + - [[#quick-example][Quick Example]] | ||
| 15 | + - [[#features][Features]] | ||
| 16 | + - [[#key-configuration-areas][Key Configuration Areas]] | ||
| 17 | + - [[#creating-your-config][Creating Your Config]] | ||
| 14 | - [[#contributing][Contributing]] | 18 | - [[#contributing][Contributing]] |
| 15 | - [[#key-bindings][Key Bindings]] | 19 | - [[#key-bindings][Key Bindings]] |
| 16 | -- [[#features][Features]] | 20 | +- [[#features-1][Features]] |
| 17 | - [[#testing-with-xephyr][Testing with Xephyr]] | 21 | - [[#testing-with-xephyr][Testing with Xephyr]] |
| 18 | - [[#project-structure][Project Structure]] | 22 | - [[#project-structure][Project Structure]] |
| 19 | - [[#architecture-notes][Architecture Notes]] | 23 | - [[#architecture-notes][Architecture Notes]] |
| 24 | + - [[#lua-configuration-system][Lua Configuration System]] | ||
| 20 | - [[#tag-system][Tag System]] | 25 | - [[#tag-system][Tag System]] |
| 21 | - [[#status-bar][Status Bar]] | 26 | - [[#status-bar][Status Bar]] |
| 22 | - [[#layout-system][Layout System]] | 27 | - [[#layout-system][Layout System]] |
| 23 | - [[#current-todo-list][Current Todo List:]] | 28 | - [[#current-todo-list][Current Todo List:]] |
| 24 | - - [[#priority-high-02][PRIORITY High]] | 29 | + - [[#priority-high-04][PRIORITY High]] |
| 25 | - - [[#priority-medium-14][PRIORITY Medium]] | ||
| 26 | - - [[#priority-low-11][PRIORITY Low]] | ||
| 27 | - [[#development-roadmap][Development Roadmap]] | 30 | - [[#development-roadmap][Development Roadmap]] |
| 28 | - - [[#current-focus][Current Focus]] | 31 | + - [[#current-focus-v080][Current Focus (v0.8.0)]] |
| 29 | - - [[#future-enhancements][Future Enhancements]] | 32 | + - [[#completed-features-88][Completed Features]] |
| 33 | + - [[#future-enhancements-][Future Enhancements]] | ||
| 30 | - [[#license][License]] | 34 | - [[#license][License]] |
| 31 | 35 | ||
| 32 | * OXWM — DWM but Better (and oxidized) | 36 | * OXWM — DWM but Better (and oxidized) |
| @@ -181,8 +185,21 @@ oxwm.key.bind({ "Mod4" }, "Q", oxwm.client.kill()) | |||
| 181 | oxwm.key.bind({ "Mod4", "Shift" }, "Q", oxwm.quit()) | 185 | oxwm.key.bind({ "Mod4", "Shift" }, "Q", oxwm.quit()) |
| 182 | 186 | ||
| 183 | -- Add status bar blocks | 187 | -- Add status bar blocks |
| 184 | -oxwm.bar.add_block("{}", "DateTime", "%H:%M", 60, "#0db9d7", true) | 188 | +oxwm.bar.set_blocks({ |
| 185 | -oxwm.bar.add_block("RAM: {used}/{total} GB", "Ram", nil, 5, "#7aa2f7", true) | 189 | + oxwm.bar.block.datetime({ |
| 190 | + format = "{}", | ||
| 191 | + date_format = "%H:%M", | ||
| 192 | + interval = 60, | ||
| 193 | + color = "#0db9d7", | ||
| 194 | + underline = true, | ||
| 195 | + }), | ||
| 196 | + oxwm.bar.block.ram({ | ||
| 197 | + format = "RAM: {used}/{total} GB", | ||
| 198 | + interval = 5, | ||
| 199 | + color = "#7aa2f7", | ||
| 200 | + underline = true, | ||
| 201 | + }), | ||
| 202 | +}) | ||
| 186 | #+end_src | 203 | #+end_src |
| 187 | 204 | ||
| 188 | ** Features | 205 | ** Features |
| @@ -220,38 +237,75 @@ When contributing to OXWM: | |||
| 220 | 4. Document any new features or keybindings | 237 | 4. Document any new features or keybindings |
| 221 | 238 | ||
| 222 | * Key Bindings | 239 | * Key Bindings |
| 223 | -Default keybindings (customizable in config.rs): | 240 | +Default keybindings (fully customizable in =~/.config/oxwm/config.lua=): |
| 224 | - | 241 | + |
| 225 | -| Binding | Action | | 242 | +| Binding | Action | |
| 226 | -|-------------------+-------------------------| | 243 | +|------------------------+-----------------------------------| |
| 227 | -| Super+Return | Spawn terminal | | 244 | +| Super+Return | Spawn terminal | |
| 228 | -| Super+J/K | Cycle focus down/up | | 245 | +| Super+J/K | Cycle focus through stack | |
| 229 | -| Super+Q | Kill focused window | | 246 | +| Super+Q | Kill focused window | |
| 230 | -| Super+Shift+Q | Quit WM | | 247 | +| Super+Shift+Q | Quit WM | |
| 231 | -| Super+Shift+R | Hot reload WM | | 248 | +| Super+Shift+R | Hot reload WM | |
| 232 | -| Super+1-9 | View tag 1-9 | | 249 | +| Super+1-9 | View tag 1-9 | |
| 233 | -| Super+Shift+1-9 | Move window to tag 1-9 | | 250 | +| Super+Shift+1-9 | Move window to tag 1-9 | |
| 234 | -| Super+S | Screenshot (maim) | | 251 | +| Super+Ctrl+1-9 | Toggle tag view (multi-tag) | |
| 235 | -| Super+D | dmenu launcher | | 252 | +| Super+Ctrl+Shift+1-9 | Toggle window tag (sticky) | |
| 236 | -| Super+A | Toggle gaps | | 253 | +| Super+S | Screenshot (maim) | |
| 237 | -| Super+Shift+F | Toggle fullscreen | | 254 | +| Super+D | dmenu launcher | |
| 238 | -| Super+Shift+Space | Toggle floating | | 255 | +| Super+A | Toggle gaps | |
| 256 | +| Super+Shift+F | Toggle fullscreen | | ||
| 257 | +| Super+Shift+Space | Toggle floating | | ||
| 258 | +| Super+F | Set normie (floating) layout | | ||
| 259 | +| Super+C | Set tiling layout | | ||
| 260 | +| Super+N | Cycle layouts | | ||
| 261 | +| Super+Comma/Period | Focus prev/next monitor | | ||
| 262 | +| Super+Shift+Comma/. | Send window to prev/next monitor | | ||
| 263 | +| Super+[/] | Decrease/increase master area | | ||
| 264 | +| Super+I/P | Inc/dec number of master windows | | ||
| 265 | +| Super+Shift+/ | Show keybinds overlay | | ||
| 266 | +| Super+Button1 (drag) | Move window (floating) | | ||
| 267 | +| Super+Button3 (drag) | Resize window (floating) | | ||
| 239 | 268 | ||
| 240 | * Features | 269 | * Features |
| 241 | -- Dynamic tiling layout with master/stack | 270 | +- *Dynamic Tiling Layout* with adjustable master/stack split |
| 242 | -- Tag-based workspaces (9 tags by default) | 271 | + - Master area resizing (mfact) |
| 243 | -- Configurable gaps between windows | 272 | + - Multiple master windows support (nmaster) |
| 244 | -- Status bar with modular block system | 273 | +- *Tag-Based Workspaces* (9 tags by default) |
| 245 | - - Battery, RAM, datetime, shell commands | 274 | + - Multi-tag viewing (see multiple tags at once) |
| 246 | - - Custom colors and update intervals | 275 | + - Sticky windows (window visible on multiple tags) |
| 276 | +- *Multiple Layouts* | ||
| 277 | + - Tiling (master/stack) | ||
| 278 | + - Normie (floating-by-default) | ||
| 279 | + - Monocle (fullscreen stacking) | ||
| 280 | + - Grid (equal-sized grid) | ||
| 281 | + - Tabbed (tabbed windows) | ||
| 282 | +- *Lua Configuration System* | ||
| 283 | + - Hot reload without restarting X (=Mod+Shift+R=) | ||
| 284 | + - LSP support with type definitions and autocomplete | ||
| 285 | + - No compilation needed - instant config changes | ||
| 286 | +- *Built-in Status Bar* with modular block system | ||
| 287 | + - Battery, RAM, datetime, shell commands, static text | ||
| 288 | + - Custom colors, update intervals, and underlines | ||
| 247 | - Click-to-switch tags | 289 | - Click-to-switch tags |
| 248 | -- Window focus cycling | 290 | + - Multi-monitor support (one bar per monitor) |
| 249 | -- Hot reload without restarting X | 291 | +- *Advanced Window Management* |
| 250 | -- Persistent window tags across restarts | 292 | + - Window focus cycling through stack |
| 251 | -- Mouse hover to focus | 293 | + - Fullscreen mode |
| 252 | -- Border indicators for focused windows | 294 | + - Floating window support |
| 253 | -- Fullscreen mode | 295 | + - Mouse hover to focus (follow mouse) |
| 254 | -- Move Windows with Super HJKL | 296 | + - Border indicators for focused windows |
| 297 | + - Configurable gaps (smartgaps support) | ||
| 298 | + - Window rules (auto-tag, auto-float by class/title) | ||
| 299 | +- *Multi-Monitor Support* | ||
| 300 | + - RandR multi-monitor detection | ||
| 301 | + - Independent tags per monitor | ||
| 302 | + - Move windows between monitors | ||
| 303 | +- *Keychord Support* | ||
| 304 | + - Multi-key sequences (Emacs/Vim style) | ||
| 305 | + - Example: =Mod+Space= then =T= to spawn terminal | ||
| 306 | +- *Persistent State* | ||
| 307 | + - Window tags persist across WM restarts | ||
| 308 | + - Uses X11 properties for state storage | ||
| 255 | 309 | ||
| 256 | * Testing with Xephyr | 310 | * Testing with Xephyr |
| 257 | Test OXWM in a nested X server without affecting your current session: | 311 | Test OXWM in a nested X server without affecting your current session: |
| @@ -340,7 +394,11 @@ src/ | |||
| 340 | │ | 394 | │ |
| 341 | ├── layout/ | 395 | ├── layout/ |
| 342 | │ ├── mod.rs [Layout trait definition] | 396 | │ ├── mod.rs [Layout trait definition] |
| 343 | -│ └── tiling.rs [Tiling layout implementation] | 397 | +│ ├── tiling.rs [Tiling layout with master/stack] |
| 398 | +│ ├── monocle.rs [Fullscreen stacking layout] | ||
| 399 | +│ ├── grid.rs [Equal-sized grid layout] | ||
| 400 | +│ ├── tabbed.rs [Tabbed container layout] | ||
| 401 | +│ └── normie.rs [Floating-by-default layout] | ||
| 344 | │ | 402 | │ |
| 345 | └── errors.rs [Error types: WmError, ConfigError, etc.] | 403 | └── errors.rs [Error types: WmError, ConfigError, etc.] |
| 346 | 404 | ||
| @@ -373,48 +431,43 @@ The bar uses a performance-optimized approach with a modular block system: | |||
| 373 | The tiling layout divides the screen into a master area (left half) and stack area (right half). The master window occupies the full height of the master area, while stack windows split the stack area vertically. Gaps are configurable and can be toggled at runtime. | 431 | The tiling layout divides the screen into a master area (left half) and stack area (right half). The master window occupies the full height of the master area, while stack windows split the stack area vertically. Gaps are configurable and can be toggled at runtime. |
| 374 | 432 | ||
| 375 | * TODO Current Todo List: | 433 | * TODO Current Todo List: |
| 376 | -** PRIORITY High [0/2] | 434 | +** PRIORITY High [0/4] |
| 377 | -- [ ] Convert keycodes to keysyms for cross-keyboard compatibility | 435 | +- [ ] Add Window Titles to Bar |
| 378 | - - Current hardcoded keycodes only work on specific keyboards | 436 | + - Show focused window title in status bar |
| 379 | - - Need to use XKeysymToKeycode() for runtime conversion | 437 | + - Truncate if too long |
| 380 | - - Follow DWM's approach: keysym → keycode conversion | 438 | + - Update on window focus change |
| 381 | -- [ ] Fix fullscreen to persist across tags | 439 | +- [ ] Add Horizontal Scroll Layout |
| 382 | - - Fullscreen state should be maintained when switching tags | 440 | + - Master window on left, stack scrolls horizontally |
| 383 | - - Window should remain fullscreen when returning to its tag | 441 | + - Alternative to vertical tiling |
| 384 | - | 442 | +- [ ] Add Hide Empty Tag Numbers Option |
| 385 | -** PRIORITY Medium [2/4] | 443 | + - Option to hide tags with no windows |
| 386 | -- [ ] Add keybindings to increase/decrease window size | 444 | + - Configurable via =oxwm.bar.set_hide_empty_tags(bool)= |
| 387 | - - Master area resize (Mod+H / Mod+L) | 445 | +- [ ] Add Swap Stack Bind |
| 388 | - - Individual window resize for floating windows | 446 | + - Keybind to swap focused window with master |
| 389 | -- [X] Keychords | 447 | + - Similar to dwm's zoom function (=Mod+Return=) |
| 390 | - - Implemented with =oxwm.key.chord()= in the functional API | 448 | + - Should work bidirectionally |
| 391 | - - Example: =oxwm.key.chord({ { {"Mod4"}, "Space" }, { {}, "T" } }, oxwm.spawn("st"))= | ||
| 392 | -- [X] Fix cursor on hover for bar | ||
| 393 | - - Bar should show pointer cursor on hover | ||
| 394 | - - Indicate clickable tag areas | ||
| 395 | -- [ ] Add auto-detect terminal to default config | ||
| 396 | - - Auto-detect available terminal emulator | ||
| 397 | - - Priority order: st → alacritty → kitty → wezterm → xterm | ||
| 398 | - - Fallback to xterm if none found | ||
| 399 | - | ||
| 400 | -** PRIORITY Low [1/1] | ||
| 401 | -- [X] Create AUR package | ||
| 402 | - - Write PKGBUILD | ||
| 403 | - - Submit to AUR | ||
| 404 | - - Add installation instructions to README | ||
| 405 | * Development Roadmap | 449 | * Development Roadmap |
| 406 | -** Current Focus | 450 | +** Current Focus (v0.8.0) |
| 407 | -- Multi-monitor support | 451 | +- Refactoring to align with dwm's proven patterns |
| 408 | -- Additional layouts (monocle, floating) | 452 | +- Improving core window management reliability |
| 409 | -- Master area resizing | 453 | +- Maintaining Lua config and bar features while simplifying internals |
| 410 | -- Window swapping in layout | 454 | + |
| 411 | - | 455 | +** Completed Features [8/8] |
| 412 | -** Future Enhancements | 456 | +- [X] Multi-monitor support with RandR |
| 413 | -- Per-window floating behavior | 457 | +- [X] Multiple layouts (tiling, monocle, grid, tabbed, normie) |
| 414 | -- Per-program rules (auto-tag assignment, floating rules) | 458 | +- [X] Master area resizing (mfact) and nmaster support |
| 415 | -- External bar support (polybar, etc) | 459 | +- [X] Window rules (per-program auto-tag, floating) |
| 416 | -- Scratchpad functionality | 460 | +- [X] Lua configuration with hot-reload |
| 417 | -- Window minimize/restore | 461 | +- [X] Built-in status bar with modular blocks |
| 462 | +- [X] Keychord support (multi-key sequences) | ||
| 463 | +- [X] Tag persistence across restarts | ||
| 464 | + | ||
| 465 | +** Future Enhancements [/] | ||
| 466 | +- [ ] Scratchpad functionality | ||
| 467 | +- [ ] Dynamic monitor hotplugging (currently only on startup) | ||
| 468 | +- [ ] External bar support (polybar, waybar compatibility) | ||
| 469 | +- [ ] Additional layouts (deck, spiral, dwindle) | ||
| 470 | +- [ ] Window minimize/restore | ||
| 418 | 471 | ||
| 419 | * License | 472 | * License |
| 420 | [[https://www.gnu.org/licenses/gpl-3.0.en.html][GPL v3]] | 473 | [[https://www.gnu.org/licenses/gpl-3.0.en.html][GPL v3]] |
+12 −8 src/window_manager.rs
| @@ -317,9 +317,14 @@ impl WindowManager { | |||
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | pub fn show_migration_overlay(&mut self) { | 319 | pub fn show_migration_overlay(&mut self) { |
| 320 | - let message = "Your config.lua uses legacy syntax or has errors.\n\n\ | 320 | + let message = "We are on version 0.8.0 now.\n\n\ |
| 321 | - You are now running with default configuration.\n\n\ | 321 | + Your config file has been deprecated once again.\n\ |
| 322 | - Press Mod+Shift+/ to see default keybinds\n\ | 322 | + We apologize for this, but we have provided you\n\ |
| 323 | + with a new default config.\n\n\ | ||
| 324 | + Please reach out to Tony, or check out the\n\ | ||
| 325 | + documentation for help with migration.\n\n\ | ||
| 326 | + We appreciate you testing oxwm!\n\n\ | ||
| 327 | + Press Mod+Shift+/ to see keybinds\n\ | ||
| 323 | Press Mod+Shift+R to reload after fixing your config"; | 328 | Press Mod+Shift+R to reload after fixing your config"; |
| 324 | 329 | ||
| 325 | let screen_width = self.screen.width_in_pixels; | 330 | let screen_width = self.screen.width_in_pixels; |
| @@ -2380,6 +2385,10 @@ impl WindowManager { | |||
| 2380 | let snap = 32; | 2385 | let snap = 32; |
| 2381 | let is_normie = self.layout.name() == "normie"; | 2386 | let is_normie = self.layout.name() == "normie"; |
| 2382 | 2387 | ||
| 2388 | + if !was_floating && !is_normie { | ||
| 2389 | + self.toggle_floating()?; | ||
| 2390 | + } | ||
| 2391 | + | ||
| 2383 | self.connection.grab_pointer( | 2392 | self.connection.grab_pointer( |
| 2384 | false, | 2393 | false, |
| 2385 | self.root, | 2394 | self.root, |
| @@ -2422,11 +2431,6 @@ impl WindowManager { | |||
| 2422 | new_y = monitor.window_area_y + monitor.window_area_height - height as i32; | 2431 | new_y = monitor.window_area_y + monitor.window_area_height - height as i32; |
| 2423 | } | 2432 | } |
| 2424 | 2433 | ||
| 2425 | - if !was_floating && !is_normie && | ||
| 2426 | - ((new_x - orig_x as i32).abs() > snap || (new_y - orig_y as i32).abs() > snap) { | ||
| 2427 | - self.toggle_floating()?; | ||
| 2428 | - } | ||
| 2429 | - | ||
| 2430 | let should_resize = is_normie || self.clients | 2434 | let should_resize = is_normie || self.clients |
| 2431 | .get(&window) | 2435 | .get(&window) |
| 2432 | .map(|c| c.is_floating) | 2436 | .map(|c| c.is_floating) |
+33 −77 templates/config.lua
| @@ -123,6 +123,26 @@ oxwm.gaps.set_enabled(true) -- Enable or disable gaps | |||
| 123 | oxwm.gaps.set_inner(5, 5) -- Inner gaps (horizontal, vertical) in pixels | 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 | 124 | oxwm.gaps.set_outer(5, 5) -- Outer gaps (horizontal, vertical) in pixels |
| 125 | 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 | + | ||
| 126 | ------------------------------------------------------------------------------- | 146 | ------------------------------------------------------------------------------- |
| 127 | -- Status Bar Configuration | 147 | -- Status Bar Configuration |
| 128 | ------------------------------------------------------------------------------- | 148 | ------------------------------------------------------------------------------- |
| @@ -167,6 +187,12 @@ oxwm.key.bind({ modkey }, "F", oxwm.layout.set("normie")) -- Set floating layout | |||
| 167 | oxwm.key.bind({ modkey }, "C", oxwm.layout.set("tiling")) -- Set tiling layout | 187 | oxwm.key.bind({ modkey }, "C", oxwm.layout.set("tiling")) -- Set tiling layout |
| 168 | oxwm.key.bind({ modkey }, "N", oxwm.layout.cycle()) -- Cycle through layouts | 188 | oxwm.key.bind({ modkey }, "N", oxwm.layout.cycle()) -- Cycle through layouts |
| 169 | 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 | + | ||
| 170 | -- Gaps toggle | 196 | -- Gaps toggle |
| 171 | oxwm.key.bind({ modkey }, "A", oxwm.toggle_gaps()) -- Toggle gaps on/off | 197 | oxwm.key.bind({ modkey }, "A", oxwm.toggle_gaps()) -- Toggle gaps on/off |
| 172 | 198 | ||
| @@ -174,15 +200,15 @@ oxwm.key.bind({ modkey }, "A", oxwm.toggle_gaps()) -- Toggle gaps on/off | |||
| 174 | oxwm.key.bind({ modkey, "Shift" }, "Q", oxwm.quit()) -- Quit OXWM | 200 | oxwm.key.bind({ modkey, "Shift" }, "Q", oxwm.quit()) -- Quit OXWM |
| 175 | oxwm.key.bind({ modkey, "Shift" }, "R", oxwm.restart()) -- Restart OXWM (reloads config) | 201 | oxwm.key.bind({ modkey, "Shift" }, "R", oxwm.restart()) -- Restart OXWM (reloads config) |
| 176 | 202 | ||
| 177 | --- Focus movement (vim keys) | 203 | +-- Focus movement (stack cycling) |
| 178 | -oxwm.key.bind({ modkey }, "H", oxwm.client.focus_direction("left")) -- Focus window to the left | 204 | +oxwm.key.bind({ modkey }, "J", oxwm.client.focus_stack(1)) -- Focus next window in stack |
| 179 | -oxwm.key.bind({ modkey }, "J", oxwm.client.focus_direction("down")) -- Focus window below | 205 | +oxwm.key.bind({ modkey }, "K", oxwm.client.focus_stack(-1)) -- Focus previous window in stack |
| 180 | -oxwm.key.bind({ modkey }, "K", oxwm.client.focus_direction("up")) -- Focus window above | ||
| 181 | -oxwm.key.bind({ modkey }, "L", oxwm.client.focus_direction("right")) -- Focus window to the right | ||
| 182 | 206 | ||
| 183 | -- Multi-monitor support | 207 | -- Multi-monitor support |
| 184 | -oxwm.key.bind({ modkey }, "Comma", oxwm.focus_monitor(-1)) -- Focus previous monitor | 208 | +oxwm.key.bind({ modkey }, "Comma", oxwm.monitor.focus(-1)) -- Focus previous monitor |
| 185 | -oxwm.key.bind({ modkey }, "Period", oxwm.focus_monitor(1)) -- Focus next monitor | 209 | +oxwm.key.bind({ modkey }, "Period", oxwm.monitor.focus(1)) -- Focus next monitor |
| 210 | +oxwm.key.bind({ modkey, "Shift" }, "Comma", oxwm.monitor.tag(-1)) -- Send window to previous monitor | ||
| 211 | +oxwm.key.bind({ modkey, "Shift" }, "Period", oxwm.monitor.tag(1)) -- Send window to next monitor | ||
| 186 | 212 | ||
| 187 | -- Workspace (tag) navigation | 213 | -- Workspace (tag) navigation |
| 188 | -- Switch to workspace N (tags are 0-indexed, so tag "1" is index 0) | 214 | -- Switch to workspace N (tags are 0-indexed, so tag "1" is index 0) |
| @@ -207,12 +233,6 @@ oxwm.key.bind({ modkey, "Shift" }, "7", oxwm.tag.move_to(6)) | |||
| 207 | oxwm.key.bind({ modkey, "Shift" }, "8", oxwm.tag.move_to(7)) | 233 | oxwm.key.bind({ modkey, "Shift" }, "8", oxwm.tag.move_to(7)) |
| 208 | oxwm.key.bind({ modkey, "Shift" }, "9", oxwm.tag.move_to(8)) | 234 | oxwm.key.bind({ modkey, "Shift" }, "9", oxwm.tag.move_to(8)) |
| 209 | 235 | ||
| 210 | --- Swap windows in direction (vim keys with Shift) | ||
| 211 | -oxwm.key.bind({ modkey, "Shift" }, "H", oxwm.client.swap_direction("left")) -- Swap with window to the left | ||
| 212 | -oxwm.key.bind({ modkey, "Shift" }, "J", oxwm.client.swap_direction("down")) -- Swap with window below | ||
| 213 | -oxwm.key.bind({ modkey, "Shift" }, "K", oxwm.client.swap_direction("up")) -- Swap with window above | ||
| 214 | -oxwm.key.bind({ modkey, "Shift" }, "L", oxwm.client.swap_direction("right")) -- Swap with window to the right | ||
| 215 | - | ||
| 216 | ------------------------------------------------------------------------------- | 236 | ------------------------------------------------------------------------------- |
| 217 | -- Advanced: Keychords | 237 | -- Advanced: Keychords |
| 218 | ------------------------------------------------------------------------------- | 238 | ------------------------------------------------------------------------------- |
| @@ -224,70 +244,6 @@ oxwm.key.chord({ | |||
| 224 | { {}, "T" } | 244 | { {}, "T" } |
| 225 | }, oxwm.spawn_terminal()) | 245 | }, oxwm.spawn_terminal()) |
| 226 | 246 | ||
| 227 | -------------------------------------------------------------------------------- | ||
| 228 | --- Status Bar Blocks | ||
| 229 | -------------------------------------------------------------------------------- | ||
| 230 | --- Add informational blocks to the status bar using block constructors | ||
| 231 | --- Each block is created with oxwm.bar.block.<type>() and configured with a table: | ||
| 232 | --- format: Display format with {} placeholders | ||
| 233 | --- interval: Seconds between updates | ||
| 234 | --- color: Text color (from color palette) | ||
| 235 | --- underline: Whether to underline the block | ||
| 236 | --- | ||
| 237 | --- Available block types: | ||
| 238 | --- ram(config) - Memory usage | ||
| 239 | --- datetime(config) - Date and time (requires date_format field) | ||
| 240 | --- shell(config) - Shell command output (requires command field) | ||
| 241 | --- static(config) - Static text (requires text field) | ||
| 242 | --- battery(config) - Battery status (requires charging, discharging, full fields) | ||
| 243 | - | ||
| 244 | -oxwm.bar.set_blocks({ | ||
| 245 | - oxwm.bar.block.ram({ | ||
| 246 | - format = "Ram: {used}/{total} GB", | ||
| 247 | - interval = 5, | ||
| 248 | - color = colors.light_blue, | ||
| 249 | - underline = true, | ||
| 250 | - }), | ||
| 251 | - oxwm.bar.block.static({ | ||
| 252 | - format = "{}", | ||
| 253 | - text = " │ ", | ||
| 254 | - interval = 999999999, | ||
| 255 | - color = colors.lavender, | ||
| 256 | - underline = false, | ||
| 257 | - }), | ||
| 258 | - oxwm.bar.block.shell({ | ||
| 259 | - format = "Kernel: {}", | ||
| 260 | - command = "uname -r", | ||
| 261 | - interval = 999999999, | ||
| 262 | - color = colors.red, | ||
| 263 | - underline = true, | ||
| 264 | - }), | ||
| 265 | - oxwm.bar.block.static({ | ||
| 266 | - format = "{}", | ||
| 267 | - text = " │ ", | ||
| 268 | - interval = 999999999, | ||
| 269 | - color = colors.lavender, | ||
| 270 | - underline = false, | ||
| 271 | - }), | ||
| 272 | - oxwm.bar.block.datetime({ | ||
| 273 | - format = "{}", | ||
| 274 | - date_format = "%a, %b %d - %-I:%M %P", | ||
| 275 | - interval = 1, | ||
| 276 | - color = colors.cyan, | ||
| 277 | - underline = true, | ||
| 278 | - }), | ||
| 279 | - -- Uncomment to add battery status (useful for laptops) | ||
| 280 | - -- oxwm.bar.block.battery({ | ||
| 281 | - -- format = "Bat: {}%", | ||
| 282 | - -- charging = "⚡ Bat: {}%", | ||
| 283 | - -- discharging = "🔋 Bat: {}%", | ||
| 284 | - -- full = "✓ Bat: {}%", | ||
| 285 | - -- interval = 30, | ||
| 286 | - -- color = colors.green, | ||
| 287 | - -- underline = true, | ||
| 288 | - -- }), | ||
| 289 | -}) | ||
| 290 | - | ||
| 291 | ------------------------------------------------------------------------------- | 247 | ------------------------------------------------------------------------------- |
| 292 | -- Autostart | 248 | -- Autostart |
| 293 | ------------------------------------------------------------------------------- | 249 | ------------------------------------------------------------------------------- |
+42 −15 templates/oxwm.lua
| @@ -42,6 +42,14 @@ function oxwm.set_tags(tags) end | |||
| 42 | ---@param symbol string Symbol to display (e.g., "[T]", "[F]", "[=]") | 42 | ---@param symbol string Symbol to display (e.g., "[T]", "[F]", "[=]") |
| 43 | function oxwm.set_layout_symbol(name, symbol) end | 43 | function oxwm.set_layout_symbol(name, symbol) end |
| 44 | 44 | ||
| 45 | +---Window rule module | ||
| 46 | +---@class oxwm.rule | ||
| 47 | +oxwm.rule = {} | ||
| 48 | + | ||
| 49 | +---Add a window rule | ||
| 50 | +---@param rule {class: string?, instance: string?, title: string?, role: string?, floating: boolean?, tag: integer?, fullscreen: boolean?} Rule configuration | ||
| 51 | +function oxwm.rule.add(rule) end | ||
| 52 | + | ||
| 45 | ---Quit the window manager | 53 | ---Quit the window manager |
| 46 | ---@return table Action table for keybinding | 54 | ---@return table Action table for keybinding |
| 47 | function oxwm.quit() end | 55 | function oxwm.quit() end |
| @@ -62,10 +70,15 @@ function oxwm.toggle_gaps() end | |||
| 62 | ---@return table Action table for keybinding | 70 | ---@return table Action table for keybinding |
| 63 | function oxwm.show_keybinds() end | 71 | function oxwm.show_keybinds() end |
| 64 | 72 | ||
| 65 | ----Focus monitor by index | 73 | +---Set master area factor (adjust master window width in tiling layout) |
| 66 | ----@param index integer Monitor index (-1 for previous, 1 for next) | 74 | +---@param delta integer Delta to adjust by (negative to decrease, positive to increase) |
| 67 | ---@return table Action table for keybinding | 75 | ---@return table Action table for keybinding |
| 68 | -function oxwm.focus_monitor(index) end | 76 | +function oxwm.set_master_factor(delta) end |
| 77 | + | ||
| 78 | +---Increment/decrement number of master windows | ||
| 79 | +---@param delta integer Delta to adjust by (negative to decrease, positive to increase) | ||
| 80 | +---@return table Action table for keybinding | ||
| 81 | +function oxwm.inc_num_master(delta) end | ||
| 69 | 82 | ||
| 70 | ---Keybinding module | 83 | ---Keybinding module |
| 71 | ---@class oxwm.key | 84 | ---@class oxwm.key |
| @@ -106,6 +119,10 @@ function oxwm.gaps.set_inner(horizontal, vertical) end | |||
| 106 | ---@param vertical integer Vertical outer gap in pixels | 119 | ---@param vertical integer Vertical outer gap in pixels |
| 107 | function oxwm.gaps.set_outer(horizontal, vertical) end | 120 | function oxwm.gaps.set_outer(horizontal, vertical) end |
| 108 | 121 | ||
| 122 | +---Set smart gaps (disable outer gaps when only one window visible) | ||
| 123 | +---@param enabled boolean Enable or disable smart gaps | ||
| 124 | +function oxwm.gaps.set_smart(enabled) end | ||
| 125 | + | ||
| 109 | ---Border configuration module | 126 | ---Border configuration module |
| 110 | ---@class oxwm.border | 127 | ---@class oxwm.border |
| 111 | oxwm.border = {} | 128 | oxwm.border = {} |
| @@ -138,24 +155,24 @@ function oxwm.client.toggle_fullscreen() end | |||
| 138 | ---@return table Action table for keybinding | 155 | ---@return table Action table for keybinding |
| 139 | function oxwm.client.toggle_floating() end | 156 | function oxwm.client.toggle_floating() end |
| 140 | 157 | ||
| 141 | ----Focus window in direction | ||
| 142 | ----@param direction "up"|"down"|"left"|"right" Direction to focus | ||
| 143 | ----@return table Action table for keybinding | ||
| 144 | -function oxwm.client.focus_direction(direction) end | ||
| 145 | - | ||
| 146 | ----Swap window in direction | ||
| 147 | ----@param direction "up"|"down"|"left"|"right" Direction to swap | ||
| 148 | ----@return table Action table for keybinding | ||
| 149 | -function oxwm.client.swap_direction(direction) end | ||
| 150 | - | ||
| 151 | ---Focus stack (next/previous window) | 158 | ---Focus stack (next/previous window) |
| 152 | ---@param dir integer Direction (1 for next, -1 for previous) | 159 | ---@param dir integer Direction (1 for next, -1 for previous) |
| 153 | ---@return table Action table for keybinding | 160 | ---@return table Action table for keybinding |
| 154 | function oxwm.client.focus_stack(dir) end | 161 | function oxwm.client.focus_stack(dir) end |
| 155 | 162 | ||
| 156 | ----Exchange client positions | 163 | +---Monitor management module |
| 164 | +---@class oxwm.monitor | ||
| 165 | +oxwm.monitor = {} | ||
| 166 | + | ||
| 167 | +---Focus monitor | ||
| 168 | +---@param dir integer Direction (-1 for previous, 1 for next) | ||
| 169 | +---@return table Action table for keybinding | ||
| 170 | +function oxwm.monitor.focus(dir) end | ||
| 171 | + | ||
| 172 | +---Send focused window to monitor | ||
| 173 | +---@param dir integer Direction (-1 for previous, 1 for next) | ||
| 157 | ---@return table Action table for keybinding | 174 | ---@return table Action table for keybinding |
| 158 | -function oxwm.client.exchange() end | 175 | +function oxwm.monitor.tag(dir) end |
| 159 | 176 | ||
| 160 | ---Layout management module | 177 | ---Layout management module |
| 161 | ---@class oxwm.layout | 178 | ---@class oxwm.layout |
| @@ -184,6 +201,16 @@ function oxwm.tag.view(index) end | |||
| 184 | ---@return table Action table for keybinding | 201 | ---@return table Action table for keybinding |
| 185 | function oxwm.tag.move_to(index) end | 202 | function oxwm.tag.move_to(index) end |
| 186 | 203 | ||
| 204 | +---Toggle viewing a tag (allows viewing multiple tags at once) | ||
| 205 | +---@param index integer Tag index (0-based) | ||
| 206 | +---@return table Action table for keybinding | ||
| 207 | +function oxwm.tag.toggleview(index) end | ||
| 208 | + | ||
| 209 | +---Toggle tag on focused window (allows window to appear on multiple tags) | ||
| 210 | +---@param index integer Tag index (0-based) | ||
| 211 | +---@return table Action table for keybinding | ||
| 212 | +function oxwm.tag.toggletag(index) end | ||
| 213 | + | ||
| 187 | ---Status bar configuration module | 214 | ---Status bar configuration module |
| 188 | ---@class oxwm.bar | 215 | ---@class oxwm.bar |
| 189 | oxwm.bar = {} | 216 | oxwm.bar = {} |