Diff
diff --git a/src/bin/main.rs b/src/bin/main.rs
index db6cb3d..f6de012 100644
--- a/src/bin/main.rs
+++ b/src/bin/main.rs
@@ -101,59 +101,13 @@ fn init_config() -> Result<(), Box<dyn std::error::Error>> {
let config_path = config_directory.join("config.lua");
std::fs::write(&config_path, config_template)?;
- update_lsp_files()?;
-
println!("✓ Config created at {:?}", config_path);
- println!("✓ LSP definitions installed at {:?}/lib/oxwm.lua", config_directory);
println!(" Edit the file and reload with Mod+Shift+R");
println!(" No compilation needed - changes take effect immediately!");
Ok(())
}
-fn update_lsp_files() -> Result<(), Box<dyn std::error::Error>> {
- let config_directory = get_config_path();
-
- let system_paths = [
- PathBuf::from("/usr/share/oxwm/oxwm.lua"),
- PathBuf::from("/usr/local/share/oxwm/oxwm.lua"),
- ];
-
- let system_oxwm_lua = system_paths.iter().find(|path| path.exists());
-
- let luarc_content = if let Some(system_path) = system_oxwm_lua {
- format!(
- r#"{{
- "workspace.library": [
- "{}"
- ]
-}}
-"#,
- system_path.parent().unwrap().display()
- )
- } else {
- let library_directory = config_directory.join("lib");
- std::fs::create_dir_all(&library_directory)?;
-
- let oxwm_lua_template = include_str!("../../templates/oxwm.lua");
- let oxwm_lua_path = library_directory.join("oxwm.lua");
- std::fs::write(&oxwm_lua_path, oxwm_lua_template)?;
-
- r#"{
- "workspace.library": [
- "lib"
- ]
-}
-"#
- .to_string()
- };
-
- let luarc_path = config_directory.join(".luarc.json");
- std::fs::write(&luarc_path, luarc_content)?;
-
- Ok(())
-}
-
fn get_config_path() -> PathBuf {
dirs::config_dir()
.expect("Could not find config directory")
diff --git a/templates/config.lua b/templates/config.lua
index 50c4c21..7a545f5 100644
--- a/templates/config.lua
+++ b/templates/config.lua
@@ -25,6 +25,9 @@ local modkey = "Mod4"
local terminal = "alacritty"
-- Color palette - customize these to match your theme
+-- Alternatively you can import other files in here, such as
+-- local colors = require("colors.lua") and make colors.lua a file
+-- in the ~/.config/oxwm directory
local colors = {
fg = "#bbbbbb",
red = "#f7768e",
@@ -55,28 +58,24 @@ local blocks = {
underline = true,
}),
oxwm.bar.block.static({
- format = "{}",
text = " │ ",
interval = 999999999,
color = colors.lavender,
underline = false,
}),
oxwm.bar.block.shell({
- format = "Kernel: {}",
command = "uname -r",
interval = 999999999,
color = colors.red,
underline = true,
}),
oxwm.bar.block.static({
- format = "{}",
text = " │ ",
interval = 999999999,
color = colors.lavender,
underline = false,
}),
oxwm.bar.block.datetime({
- format = "{}",
date_format = "%a, %b %d - %-I:%M %P",
interval = 1,
color = colors.cyan,
@@ -114,14 +113,20 @@ oxwm.set_layout_symbol("tabbed", "[=]")
-- Appearance
-------------------------------------------------------------------------------
-- Border configuration
-oxwm.border.set_width(2) -- Width in pixels
-oxwm.border.set_focused_color(colors.blue) -- Color of focused window border
-oxwm.border.set_unfocused_color(colors.grey) -- Color of unfocused window borders
--- Gap configuration (space between windows and screen edges)
-oxwm.gaps.set_enabled(true) -- Enable or disable gaps
-oxwm.gaps.set_inner(5, 5) -- Inner gaps (horizontal, vertical) in pixels
-oxwm.gaps.set_outer(5, 5) -- Outer gaps (horizontal, vertical) in pixels
+-- Width in pixels
+oxwm.border.set_width(2)
+-- Color of focused window border
+oxwm.border.set_focused_color(colors.blue)
+-- Color of unfocused window borders
+oxwm.border.set_unfocused_color(colors.grey)
+
+-- Smart Enabled = No border if 1 window
+oxwm.gaps.set_smart(enabled)
+-- Inner gaps (horizontal, vertical) in pixels
+oxwm.gaps.set_inner(5, 5)
+-- Outer gaps (horizontal, vertical) in pixels
+oxwm.gaps.set_outer(5, 5)
-------------------------------------------------------------------------------
-- Window Rules
@@ -136,9 +141,9 @@ oxwm.gaps.set_outer(5, 5) -- Outer gaps (horizontal, vertical) in pixels
-- - Configure window behavior based on title or class
-- Examples (uncomment to use):
--- oxwm.rule.add({ class = "firefox", title = "Library", floating = true }) -- Make Firefox Library window floating
--- oxwm.rule.add({ instance = "gimp", tag = 5 }) -- Send GIMP to workspace 6 (0-indexed)
--- oxwm.rule.add({ instance = "mpv", floating = true }) -- Make mpv always float
+oxwm.rule.add({ instance = "gimp", floating = true })
+-- oxwm.rule.add({ class = "firefox", title = "Library", floating = true })
+-- oxwm.rule.add({ instance = "mpv", floating = true })
-- To find window properties, use xprop and click on the window
-- WM_CLASS(STRING) shows both instance and class (instance, class)
@@ -154,9 +159,13 @@ oxwm.bar.set_blocks(blocks)
-- Bar color schemes (for workspace tag display)
-- Parameters: foreground, background, border
-oxwm.bar.set_scheme_normal(colors.fg, colors.bg, "#444444") -- Unoccupied tags
-oxwm.bar.set_scheme_occupied(colors.cyan, colors.bg, colors.cyan) -- Occupied tags
-oxwm.bar.set_scheme_selected(colors.cyan, colors.bg, colors.purple) -- Currently selected tag
+
+-- Unoccupied tags
+oxwm.bar.set_scheme_normal(colors.fg, colors.bg, "#444444")
+-- Occupied tags
+oxwm.bar.set_scheme_occupied(colors.cyan, colors.bg, colors.cyan)
+-- Currently selected tag
+oxwm.bar.set_scheme_selected(colors.cyan, colors.bg, colors.purple)
-------------------------------------------------------------------------------
-- Keybindings
@@ -170,49 +179,59 @@ oxwm.bar.set_scheme_selected(colors.cyan, colors.bg, colors.purple) -- Currently
-- Common keys: Return, Space, Tab, Escape, Backspace, Delete, Left, Right, Up, Down
-- Basic window management
-oxwm.key.bind({ modkey }, "Return", oxwm.spawn_terminal()) -- Spawn terminal
-oxwm.key.bind({ modkey }, "D", oxwm.spawn({ "sh", "-c", "dmenu_run -l 10" })) -- Application launcher
-oxwm.key.bind({ modkey }, "S", oxwm.spawn({ "sh", "-c", "maim -s | xclip -selection clipboard -t image/png" })) -- Screenshot selection
-oxwm.key.bind({ modkey }, "Q", oxwm.client.kill()) -- Close focused window
+
+oxwm.key.bind({ modkey }, "Return", oxwm.spawn_terminal())
+-- Launch Dmenu
+oxwm.key.bind({ modkey }, "D", oxwm.spawn({ "sh", "-c", "dmenu_run -l 10" }))
+-- Copy screenshot to clipboard
+oxwm.key.bind({ modkey }, "S", oxwm.spawn({ "sh", "-c", "maim -s | xclip -selection clipboard -t image/png" }))
+oxwm.key.bind({ modkey }, "Q", oxwm.client.kill())
-- Keybind overlay - Shows important keybindings on screen
oxwm.key.bind({ modkey, "Shift" }, "Slash", oxwm.show_keybinds())
-- Window state toggles
-oxwm.key.bind({ modkey, "Shift" }, "F", oxwm.client.toggle_fullscreen()) -- Toggle fullscreen
-oxwm.key.bind({ modkey, "Shift" }, "Space", oxwm.client.toggle_floating()) -- Toggle floating mode
+oxwm.key.bind({ modkey, "Shift" }, "F", oxwm.client.toggle_fullscreen())
+oxwm.key.bind({ modkey, "Shift" }, "Space", oxwm.client.toggle_floating())
-- Layout management
-oxwm.key.bind({ modkey }, "F", oxwm.layout.set("normie")) -- Set floating layout
-oxwm.key.bind({ modkey }, "C", oxwm.layout.set("tiling")) -- Set tiling layout
-oxwm.key.bind({ modkey }, "N", oxwm.layout.cycle()) -- Cycle through layouts
+oxwm.key.bind({ modkey }, "F", oxwm.layout.set("normie"))
+oxwm.key.bind({ modkey }, "C", oxwm.layout.set("tiling"))
+-- Cycle through layouts
+oxwm.key.bind({ modkey }, "N", oxwm.layout.cycle())
-- Master area controls (tiling layout)
-oxwm.key.bind({ modkey }, "H", oxwm.set_master_factor(-5)) -- Decrease master area width
-oxwm.key.bind({ modkey }, "L", oxwm.set_master_factor(5)) -- Increase master area width
-oxwm.key.bind({ modkey }, "I", oxwm.inc_num_master(1)) -- Increment number of master windows
-oxwm.key.bind({ modkey }, "P", oxwm.inc_num_master(-1)) -- Decrement number of master windows
+
+-- Decrease/Increase master area width
+oxwm.key.bind({ modkey }, "H", oxwm.set_master_factor(-5))
+oxwm.key.bind({ modkey }, "L", oxwm.set_master_factor(5))
+-- Increment/Decrement number of master windows
+oxwm.key.bind({ modkey }, "I", oxwm.inc_num_master(1))
+oxwm.key.bind({ modkey }, "P", oxwm.inc_num_master(-1))
-- Gaps toggle
-oxwm.key.bind({ modkey }, "A", oxwm.toggle_gaps()) -- Toggle gaps on/off
+oxwm.key.bind({ modkey }, "A", oxwm.toggle_gaps())
-- Window manager controls
-oxwm.key.bind({ modkey, "Shift" }, "Q", oxwm.quit()) -- Quit OXWM
-oxwm.key.bind({ modkey, "Shift" }, "R", oxwm.restart()) -- Restart OXWM (reloads config)
+oxwm.key.bind({ modkey, "Shift" }, "Q", oxwm.quit())
+oxwm.key.bind({ modkey, "Shift" }, "R", oxwm.restart())
--- Focus movement (stack cycling)
-oxwm.key.bind({ modkey }, "J", oxwm.client.focus_stack(1)) -- Focus next window in stack
-oxwm.key.bind({ modkey }, "K", oxwm.client.focus_stack(-1)) -- Focus previous window in stack
+-- Focus movement [1 for up in the stack, -1 for down]
+oxwm.key.bind({ modkey }, "J", oxwm.client.focus_stack(1))
+oxwm.key.bind({ modkey }, "K", oxwm.client.focus_stack(-1))
-- Window movement (swap position in stack)
-oxwm.key.bind({ modkey, "Shift" }, "J", oxwm.client.move_stack(1)) -- Move window down in stack
-oxwm.key.bind({ modkey, "Shift" }, "K", oxwm.client.move_stack(-1)) -- Move window up in stack
+oxwm.key.bind({ modkey, "Shift" }, "J", oxwm.client.move_stack(1))
+oxwm.key.bind({ modkey, "Shift" }, "K", oxwm.client.move_stack(-1))
-- Multi-monitor support
-oxwm.key.bind({ modkey }, "Comma", oxwm.monitor.focus(-1)) -- Focus previous monitor
-oxwm.key.bind({ modkey }, "Period", oxwm.monitor.focus(1)) -- Focus next monitor
-oxwm.key.bind({ modkey, "Shift" }, "Comma", oxwm.monitor.tag(-1)) -- Send window to previous monitor
-oxwm.key.bind({ modkey, "Shift" }, "Period", oxwm.monitor.tag(1)) -- Send window to next monitor
+
+-- Focus next/previous Monitors
+oxwm.key.bind({ modkey }, "Comma", oxwm.monitor.focus(-1))
+oxwm.key.bind({ modkey }, "Period", oxwm.monitor.focus(1))
+-- Move window to next/previous Monitors
+oxwm.key.bind({ modkey, "Shift" }, "Comma", oxwm.monitor.tag(-1))
+oxwm.key.bind({ modkey, "Shift" }, "Period", oxwm.monitor.tag(1))
-- Workspace (tag) navigation
-- Switch to workspace N (tags are 0-indexed, so tag "1" is index 0)
@@ -237,6 +256,30 @@ oxwm.key.bind({ modkey, "Shift" }, "7", oxwm.tag.move_to(6))
oxwm.key.bind({ modkey, "Shift" }, "8", oxwm.tag.move_to(7))
oxwm.key.bind({ modkey, "Shift" }, "9", oxwm.tag.move_to(8))
+-- Combo view (view multiple tags at once) {argos_nothing}
+-- Example: Mod+Ctrl+2 while on tag 1 will show BOTH tags 1 and 2
+oxwm.key.bind({ modkey, "Control" }, "1", oxwm.tag.toggleview(0))
+oxwm.key.bind({ modkey, "Control" }, "2", oxwm.tag.toggleview(1))
+oxwm.key.bind({ modkey, "Control" }, "3", oxwm.tag.toggleview(2))
+oxwm.key.bind({ modkey, "Control" }, "4", oxwm.tag.toggleview(3))
+oxwm.key.bind({ modkey, "Control" }, "5", oxwm.tag.toggleview(4))
+oxwm.key.bind({ modkey, "Control" }, "6", oxwm.tag.toggleview(5))
+oxwm.key.bind({ modkey, "Control" }, "7", oxwm.tag.toggleview(6))
+oxwm.key.bind({ modkey, "Control" }, "8", oxwm.tag.toggleview(7))
+oxwm.key.bind({ modkey, "Control" }, "9", oxwm.tag.toggleview(8))
+
+-- Multi tag (window on multiple tags)
+-- Example: Mod+Ctrl+Shift+2 puts focused window on BOTH current tag and tag 2
+oxwm.key.bind({ modkey, "Control", "Shift" }, "1", oxwm.tag.toggletag(0))
+oxwm.key.bind({ modkey, "Control", "Shift" }, "2", oxwm.tag.toggletag(1))
+oxwm.key.bind({ modkey, "Control", "Shift" }, "3", oxwm.tag.toggletag(2))
+oxwm.key.bind({ modkey, "Control", "Shift" }, "4", oxwm.tag.toggletag(3))
+oxwm.key.bind({ modkey, "Control", "Shift" }, "5", oxwm.tag.toggletag(4))
+oxwm.key.bind({ modkey, "Control", "Shift" }, "6", oxwm.tag.toggletag(5))
+oxwm.key.bind({ modkey, "Control", "Shift" }, "7", oxwm.tag.toggletag(6))
+oxwm.key.bind({ modkey, "Control", "Shift" }, "8", oxwm.tag.toggletag(7))
+oxwm.key.bind({ modkey, "Control", "Shift" }, "9", oxwm.tag.toggletag(8))
+
-------------------------------------------------------------------------------
-- Advanced: Keychords
-------------------------------------------------------------------------------
@@ -254,7 +297,7 @@ oxwm.key.chord({
-- Commands to run once when OXWM starts
-- Uncomment and modify these examples, or add your own
--- oxwm.autostart("picom") -- Compositor for transparency and effects
--- oxwm.autostart("feh --bg-scale ~/wallpaper.jpg") -- Set wallpaper
--- oxwm.autostart("dunst") -- Notification daemon
--- oxwm.autostart("nm-applet") -- Network manager applet
+-- oxwm.autostart("picom")
+-- oxwm.autostart("feh --bg-scale ~/wallpaper.jpg")
+-- oxwm.autostart("dunst")
+-- oxwm.autostart("nm-applet")
diff --git a/templates/oxwm.lua b/templates/oxwm.lua
index 2520d85..45239a8 100644
--- a/templates/oxwm.lua
+++ b/templates/oxwm.lua
@@ -160,6 +160,11 @@ function oxwm.client.toggle_floating() end
---@return table Action table for keybinding
function oxwm.client.focus_stack(dir) end
+---Move stack (next/previous window)
+---@param dir integer Direction (1 for next, -1 for previous)
+---@return table Action table for keybinding
+function oxwm.client.move_stack(dir) end
+
---Monitor management module
---@class oxwm.monitor
oxwm.monitor = {}