| 1 | -- OXWM Test Configuration File (Lua) |
| 2 | -- This config uses Mod1 (Alt) as the modkey for testing in Xephyr |
| 3 | |
| 4 | ---@class LayoutSymbol |
| 5 | ---@field name string The internal layout name (e.g., "tiling", "normie") |
| 6 | ---@field symbol string The display symbol for the layout (e.g., "[T]", "[F]") |
| 7 | |
| 8 | ---@class KeyBinding |
| 9 | ---@field modifiers string[] List of modifiers: "Mod", "Mod1"-"Mod5", "Shift", "Control" |
| 10 | ---@field key string The key name (e.g., "Return", "Q", "1", "Space") |
| 11 | ---@field action string Action to perform (see below for list) |
| 12 | ---@field arg? string|number|string[] Optional argument for the action |
| 13 | |
| 14 | ---@class KeyChord |
| 15 | ---@field keys {modifiers: string[], key: string}[] Sequence of keys to press |
| 16 | ---@field action string Action to perform when chord completes |
| 17 | ---@field arg? string|number|string[] Optional argument for the action |
| 18 | |
| 19 | ---@class StatusBlock |
| 20 | ---@field format string Display format with {} placeholders |
| 21 | ---@field command string Command type: "Ram", "DateTime", "Shell", "Static", "Battery" |
| 22 | ---@field command_arg? string Argument for command (shell command, date format, etc.) |
| 23 | ---@field interval_secs number Update interval in seconds |
| 24 | ---@field color number Color as hex number (e.g., 0xff0000 for red) |
| 25 | ---@field underline boolean Whether to show underline |
| 26 | ---@field battery_formats? {charging: string, discharging: string, full: string} Battery format strings |
| 27 | |
| 28 | ---@class ColorScheme |
| 29 | ---@field foreground number Foreground color (hex) |
| 30 | ---@field background number Background color (hex) |
| 31 | ---@field underline number Underline color (hex) |
| 32 | |
| 33 | ---@class Config |
| 34 | ---@field border_width number Width of window borders in pixels |
| 35 | ---@field border_focused number Color for focused window border (hex) |
| 36 | ---@field border_unfocused number Color for unfocused window border (hex) |
| 37 | ---@field font string Font specification (e.g., "monospace:style=Bold:size=10") |
| 38 | ---@field gaps_enabled boolean Whether gaps are enabled |
| 39 | ---@field gap_inner_horizontal number Inner horizontal gap size |
| 40 | ---@field gap_inner_vertical number Inner vertical gap size |
| 41 | ---@field gap_outer_horizontal number Outer horizontal gap size |
| 42 | ---@field gap_outer_vertical number Outer vertical gap size |
| 43 | ---@field modkey string Main modifier key (e.g., "Mod4" for Super) |
| 44 | ---@field terminal string Terminal emulator command |
| 45 | ---@field tags string[] List of workspace tag names |
| 46 | ---@field layout_symbols LayoutSymbol[] Custom layout symbols |
| 47 | ---@field keybindings (KeyBinding|KeyChord)[] List of keybindings |
| 48 | ---@field status_blocks StatusBlock[] Status bar configuration blocks |
| 49 | ---@field scheme_normal ColorScheme Color scheme for normal tags |
| 50 | ---@field scheme_occupied ColorScheme Color scheme for occupied tags |
| 51 | ---@field scheme_selected ColorScheme Color scheme for selected tag |
| 52 | ---@field autostart string[] Commands to run on startup |
| 53 | |
| 54 | -- Available Actions: |
| 55 | -- "Spawn" - Launch a program (arg: string or string[]) |
| 56 | -- "KillClient" - Close focused window |
| 57 | -- "FocusStack" - Focus next/prev in stack (arg: 1 or -1) |
| 58 | -- "FocusDirection" - Focus by direction (arg: 0=up, 1=down, 2=left, 3=right) |
| 59 | -- "SwapDirection" - Swap window by direction (arg: 0=up, 1=down, 2=left, 3=right) |
| 60 | -- "Quit" - Exit window manager |
| 61 | -- "Restart" - Restart and reload config |
| 62 | -- "Recompile" - Recompile and restart |
| 63 | -- "ViewTag" - Switch to tag (arg: tag index) |
| 64 | -- "MoveToTag" - Move window to tag (arg: tag index) |
| 65 | -- "ToggleGaps" - Toggle gaps on/off |
| 66 | -- "ToggleFullScreen" - Toggle fullscreen mode |
| 67 | -- "ToggleFloating" - Toggle floating mode |
| 68 | -- "ChangeLayout" - Switch to specific layout (arg: layout name) |
| 69 | -- "CycleLayout" - Cycle through layouts |
| 70 | -- "FocusMonitor" - Focus monitor (arg: 1 or -1) |
| 71 | -- "SmartMoveWin" - Smart window movement |
| 72 | -- "ExchangeClient" - Exchange window positions |
| 73 | |
| 74 | -- Available Modifiers: |
| 75 | -- "Mod" - Replaced with configured modkey |
| 76 | -- "Mod1" - Alt key |
| 77 | -- "Mod4" - Super/Windows key |
| 78 | -- "Shift" - Shift key |
| 79 | -- "Control" - Control key |
| 80 | -- "Mod2", "Mod3", "Mod5" - Additional modifiers |
| 81 | |
| 82 | -- Define variables for easy customization |
| 83 | local terminal = "st" |
| 84 | local modkey = "Mod1" -- Alt key for Xephyr testing |
| 85 | local secondary_modkey = "Control" |
| 86 | |
| 87 | -- Color palette (Tokyo Night theme) |
| 88 | local colors = { |
| 89 | blue = 0x6dade3, |
| 90 | grey = 0xbbbbbb, |
| 91 | green = 0x9ece6a, |
| 92 | red = 0xf7768e, |
| 93 | cyan = 0x0db9d7, |
| 94 | purple = 0xad8ee6, |
| 95 | lavender = 0xa9b1d6, |
| 96 | bg = 0x1a1b26, |
| 97 | fg = 0xbbbbbb, |
| 98 | light_blue = 0x7aa2f7, |
| 99 | } |
| 100 | |
| 101 | -- Main configuration table |
| 102 | ---@type Config |
| 103 | config = { |
| 104 | -- Appearance |
| 105 | border_width = 2, |
| 106 | border_focused = colors.blue, |
| 107 | border_unfocused = colors.grey, |
| 108 | font = "monospace:style=Bold:size=10", |
| 109 | |
| 110 | -- Window gaps |
| 111 | gaps_enabled = true, |
| 112 | gap_inner_horizontal = 5, |
| 113 | gap_inner_vertical = 5, |
| 114 | gap_outer_horizontal = 5, |
| 115 | gap_outer_vertical = 5, |
| 116 | |
| 117 | -- Basics |
| 118 | modkey = modkey, |
| 119 | terminal = terminal, |
| 120 | |
| 121 | -- Workspace tags |
| 122 | tags = {"1", "2", "3", "4", "5", "6", "7", "8", "9"}, |
| 123 | |
| 124 | -- Layout symbol overrides |
| 125 | layout_symbols = { |
| 126 | {name = "tiling", symbol = "[T]"}, |
| 127 | {name = "normie", symbol = "[F]"}, |
| 128 | }, |
| 129 | |
| 130 | -- Keybindings |
| 131 | -- Using Mod1 (Alt) for Xephyr testing so it doesn't conflict with host WM |
| 132 | keybindings = { |
| 133 | -- Basic window management |
| 134 | {modifiers = {"Mod"}, key = "Return", action = "Spawn", arg = terminal}, |
| 135 | {modifiers = {"Mod"}, key = "D", action = "Spawn", arg = {"sh", "-c", "dmenu_run -l 10"}}, |
| 136 | {modifiers = {"Mod"}, key = "S", action = "Spawn", arg = {"sh", "-c", "maim -s | xclip -selection clipboard -t image/png"}}, |
| 137 | {modifiers = {"Mod"}, key = "Q", action = "KillClient"}, |
| 138 | {modifiers = {"Mod", "Shift"}, key = "F", action = "ToggleFullScreen"}, |
| 139 | {modifiers = {"Mod", "Shift"}, key = "Space", action = "ToggleFloating"}, |
| 140 | |
| 141 | -- Layout management |
| 142 | {modifiers = {"Mod"}, key = "F", action = "ChangeLayout", arg = "normie"}, |
| 143 | {modifiers = {"Mod"}, key = "C", action = "ChangeLayout", arg = "tiling"}, |
| 144 | {modifiers = {secondary_modkey}, key = "N", action = "CycleLayout"}, |
| 145 | {modifiers = {"Mod"}, key = "A", action = "ToggleGaps"}, |
| 146 | |
| 147 | -- WM control |
| 148 | {modifiers = {"Mod", "Shift"}, key = "Q", action = "Quit"}, |
| 149 | {modifiers = {"Mod", "Shift"}, key = "R", action = "Restart"}, |
| 150 | |
| 151 | -- Focus movement (vim-style hjkl) |
| 152 | {modifiers = {"Mod"}, key = "H", action = "FocusDirection", arg = 2}, -- left |
| 153 | {modifiers = {"Mod"}, key = "J", action = "FocusDirection", arg = 1}, -- down |
| 154 | {modifiers = {"Mod"}, key = "K", action = "FocusDirection", arg = 0}, -- up |
| 155 | {modifiers = {"Mod"}, key = "L", action = "FocusDirection", arg = 3}, -- right |
| 156 | |
| 157 | -- Window swapping (vim-style hjkl) |
| 158 | {modifiers = {"Mod", "Shift"}, key = "H", action = "SwapDirection", arg = 2}, -- left |
| 159 | {modifiers = {"Mod", "Shift"}, key = "J", action = "SwapDirection", arg = 1}, -- down |
| 160 | {modifiers = {"Mod", "Shift"}, key = "K", action = "SwapDirection", arg = 0}, -- up |
| 161 | {modifiers = {"Mod", "Shift"}, key = "L", action = "SwapDirection", arg = 3}, -- right |
| 162 | |
| 163 | -- Monitor focus |
| 164 | {modifiers = {"Mod"}, key = "Comma", action = "FocusMonitor", arg = -1}, |
| 165 | {modifiers = {"Mod"}, key = "Period", action = "FocusMonitor", arg = 1}, |
| 166 | |
| 167 | -- View tags |
| 168 | {modifiers = {"Mod"}, key = "1", action = "ViewTag", arg = 0}, |
| 169 | {modifiers = {"Mod"}, key = "2", action = "ViewTag", arg = 1}, |
| 170 | {modifiers = {"Mod"}, key = "3", action = "ViewTag", arg = 2}, |
| 171 | {modifiers = {"Mod"}, key = "4", action = "ViewTag", arg = 3}, |
| 172 | {modifiers = {"Mod"}, key = "5", action = "ViewTag", arg = 4}, |
| 173 | {modifiers = {"Mod"}, key = "6", action = "ViewTag", arg = 5}, |
| 174 | {modifiers = {"Mod"}, key = "7", action = "ViewTag", arg = 6}, |
| 175 | {modifiers = {"Mod"}, key = "8", action = "ViewTag", arg = 7}, |
| 176 | {modifiers = {"Mod"}, key = "9", action = "ViewTag", arg = 8}, |
| 177 | |
| 178 | -- Move window to tag |
| 179 | {modifiers = {"Mod", "Shift"}, key = "1", action = "MoveToTag", arg = 0}, |
| 180 | {modifiers = {"Mod", "Shift"}, key = "2", action = "MoveToTag", arg = 1}, |
| 181 | {modifiers = {"Mod", "Shift"}, key = "3", action = "MoveToTag", arg = 2}, |
| 182 | {modifiers = {"Mod", "Shift"}, key = "4", action = "MoveToTag", arg = 3}, |
| 183 | {modifiers = {"Mod", "Shift"}, key = "5", action = "MoveToTag", arg = 4}, |
| 184 | {modifiers = {"Mod", "Shift"}, key = "6", action = "MoveToTag", arg = 5}, |
| 185 | {modifiers = {"Mod", "Shift"}, key = "7", action = "MoveToTag", arg = 6}, |
| 186 | {modifiers = {"Mod", "Shift"}, key = "8", action = "MoveToTag", arg = 7}, |
| 187 | {modifiers = {"Mod", "Shift"}, key = "9", action = "MoveToTag", arg = 8}, |
| 188 | |
| 189 | -- Example keychord: Alt+Space, then T to spawn terminal |
| 190 | { |
| 191 | keys = { |
| 192 | {modifiers = {"Mod1"}, key = "Space"}, |
| 193 | {modifiers = {}, key = "T"} |
| 194 | }, |
| 195 | action = "Spawn", |
| 196 | arg = terminal |
| 197 | }, |
| 198 | }, |
| 199 | |
| 200 | -- Status bar blocks |
| 201 | status_blocks = { |
| 202 | { |
| 203 | format = "Ram: {used}/{total} GB", |
| 204 | command = "Ram", |
| 205 | interval_secs = 5, |
| 206 | color = colors.light_blue, |
| 207 | underline = true |
| 208 | }, |
| 209 | { |
| 210 | format = " │ ", |
| 211 | command = "Static", |
| 212 | interval_secs = 999999999, -- Very large number for static blocks |
| 213 | color = colors.lavender, |
| 214 | underline = false |
| 215 | }, |
| 216 | { |
| 217 | format = "Kernel: {}", |
| 218 | command = "Shell", |
| 219 | command_arg = "uname -r", |
| 220 | interval_secs = 999999999, |
| 221 | color = colors.red, |
| 222 | underline = true |
| 223 | }, |
| 224 | { |
| 225 | format = " │ ", |
| 226 | command = "Static", |
| 227 | interval_secs = 999999999, |
| 228 | color = colors.lavender, |
| 229 | underline = false |
| 230 | }, |
| 231 | { |
| 232 | format = "{}", |
| 233 | command = "DateTime", |
| 234 | command_arg = "%a, %b %d - %-I:%M %P", |
| 235 | interval_secs = 1, |
| 236 | color = colors.cyan, |
| 237 | underline = true |
| 238 | }, |
| 239 | }, |
| 240 | |
| 241 | -- Color schemes for bar |
| 242 | scheme_normal = { |
| 243 | foreground = colors.fg, |
| 244 | background = colors.bg, |
| 245 | underline = 0x444444 |
| 246 | }, |
| 247 | scheme_occupied = { |
| 248 | foreground = colors.cyan, |
| 249 | background = colors.bg, |
| 250 | underline = colors.cyan |
| 251 | }, |
| 252 | scheme_selected = { |
| 253 | foreground = colors.cyan, |
| 254 | background = colors.bg, |
| 255 | underline = colors.purple |
| 256 | }, |
| 257 | |
| 258 | -- Autostart commands |
| 259 | autostart = {}, |
| 260 | } |