aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2025-09-26 12:23:19 +0200
committersrdusr <trevorgray@srdusr.com>2025-09-26 12:23:19 +0200
commite4a0432383331e013808a97b7c24707e4ddc4726 (patch)
tree3ef4465be03bc7b92a0b048f02f76475045404b6 /config
parent105732dde10b317a81d5a10a3f66b315d6f85015 (diff)
downloadsrdwm-e4a0432383331e013808a97b7c24707e4ddc4726.tar.gz
srdwm-e4a0432383331e013808a97b7c24707e4ddc4726.zip
Initial Commit
Diffstat (limited to 'config')
-rw-r--r--config/srd/cross_platform_test.lua240
-rw-r--r--config/srd/init.lua51
-rw-r--r--config/srd/keybindings.lua217
-rw-r--r--config/srd/test_decorations.lua127
-rw-r--r--config/srdwm.conf182
5 files changed, 817 insertions, 0 deletions
diff --git a/config/srd/cross_platform_test.lua b/config/srd/cross_platform_test.lua
new file mode 100644
index 0000000..7299630
--- /dev/null
+++ b/config/srd/cross_platform_test.lua
@@ -0,0 +1,240 @@
+-- Cross-Platform Test Configuration
+-- This file demonstrates all the cross-platform functionality of SRDWM
+
+print("Loading cross-platform test configuration...")
+
+-- Platform detection and configuration
+local platform = srd.get_platform()
+print("Detected platform: " .. platform)
+
+-- Platform-specific settings
+if platform == "wayland" then
+ print("Configuring for Wayland/XWayland...")
+ srd.set("general.decorations_enabled", true)
+ srd.set("general.border_width", 2)
+ srd.set("general.border_color", "#2e3440")
+
+ -- Wayland-specific keybindings
+ srd.bind("Mod4+w", function()
+ -- Toggle server-side decorations
+ local window = srd.window.focused()
+ if window then
+ local current = srd.window.get_decorations(window.id)
+ srd.window.set_decorations(window.id, not current)
+ print("Wayland: Toggled server-side decorations")
+ end
+ end)
+
+elseif platform == "x11" then
+ print("Configuring for X11...")
+ srd.set("general.decorations_enabled", true)
+ srd.set("general.border_width", 3)
+ srd.set("general.border_color", "#2e3440")
+
+ -- X11-specific keybindings
+ srd.bind("Mod4+x", function()
+ -- Toggle frame windows
+ local window = srd.window.focused()
+ if window then
+ local current = srd.window.get_decorations(window.id)
+ srd.window.set_decorations(window.id, not current)
+ print("X11: Toggled frame windows")
+ end
+ end)
+
+elseif platform == "windows" then
+ print("Configuring for Windows...")
+ srd.set("general.decorations_enabled", true)
+ srd.set("general.border_width", 2)
+ srd.set("general.border_color", "#2e3440")
+
+ -- Windows-specific keybindings
+ srd.bind("Mod4+d", function()
+ -- Toggle DWM border colors
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_border_color(window.id, 255, 0, 0) -- Red border
+ print("Windows: Set DWM border color")
+ end
+ end)
+
+elseif platform == "macos" then
+ print("Configuring for macOS...")
+ srd.set("general.decorations_enabled", false) -- Limited decoration support
+ srd.set("general.border_width", 1)
+ srd.set("general.border_color", "#2e3440")
+
+ -- macOS-specific keybindings
+ srd.bind("Mod4+m", function()
+ -- Toggle overlay windows (macOS limitation)
+ local window = srd.window.focused()
+ if window then
+ print("macOS: Overlay window toggle requested")
+ end
+ end)
+end
+
+-- Universal cross-platform keybindings
+srd.bind("Mod4+1", function()
+ srd.layout.set("tiling")
+ print("Switched to tiling layout")
+end)
+
+srd.bind("Mod4+2", function()
+ srd.layout.set("dynamic")
+ print("Switched to dynamic layout (smart placement)")
+end)
+
+srd.bind("Mod4+3", function()
+ srd.layout.set("floating")
+ print("Switched to floating layout")
+end)
+
+-- Window state controls (cross-platform)
+srd.bind("Mod4+f", function()
+ local window = srd.window.focused()
+ if window then
+ srd.window.toggle_floating(window.id)
+ local floating = srd.window.is_floating(window.id)
+ print("Window floating state: " .. tostring(floating))
+ end
+end)
+
+srd.bind("Mod4+t", function()
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_floating(window.id, false)
+ print("Set window to tiling mode")
+ end
+end)
+
+srd.bind("Mod4+l", function()
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_floating(window.id, true)
+ print("Set window to floating mode")
+ end
+end)
+
+-- Decoration controls (cross-platform)
+srd.bind("Mod4+b", function()
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_border_color(window.id, 0, 255, 0) -- Green border
+ print("Set green border")
+ end
+end)
+
+srd.bind("Mod4+n", function()
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_border_color(window.id, 0, 0, 255) -- Blue border
+ print("Set blue border")
+ end
+end)
+
+srd.bind("Mod4+r", function()
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_border_color(window.id, 255, 0, 0) -- Red border
+ print("Set red border")
+ end
+end)
+
+srd.bind("Mod4+0", function()
+ local window = srd.window.focused()
+ if window then
+ -- Reset to default colors
+ srd.window.set_border_color(window.id, 46, 52, 64) -- Default color
+ srd.window.set_border_width(window.id, 2)
+ print("Reset to default decoration")
+ end
+end)
+
+-- Smart placement test
+srd.bind("Mod4+s", function()
+ print("Smart placement test:")
+ print("- Grid placement: Windows 11-style window arrangement")
+ print("- Cascade placement: Overlapping window management")
+ print("- Snap-to-edge: Edge snapping functionality")
+ print("- Overlap detection: Prevents window overlap")
+end)
+
+-- Platform-specific feature tests
+function test_platform_features()
+ print("Testing platform-specific features...")
+
+ if platform == "wayland" then
+ print("Wayland features:")
+ print("- zxdg-decoration protocol support")
+ print("- XWayland integration")
+ print("- Layer shell support")
+ print("- Server-side decorations")
+
+ elseif platform == "x11" then
+ print("X11 features:")
+ print("- Frame window reparenting")
+ print("- Custom titlebar drawing")
+ print("- Border customization")
+ print("- Event handling")
+
+ elseif platform == "windows" then
+ print("Windows features:")
+ print("- DWM border color API")
+ print("- Native decoration toggling")
+ print("- Global keyboard/mouse hooks")
+ print("- Window class management")
+
+ elseif platform == "macos" then
+ print("macOS features:")
+ print("- Accessibility APIs")
+ print("- Event tap system")
+ print("- Core Graphics integration")
+ print("- Limited decoration support")
+ end
+end
+
+-- Test function for decoration system
+function test_decoration_system()
+ print("Testing decoration system...")
+
+ -- Test decoration toggling
+ srd.window.set_decorations("test_window", true)
+ local has_decorations = srd.window.get_decorations("test_window")
+ print("Decoration test: " .. tostring(has_decorations))
+
+ -- Test border color
+ srd.window.set_border_color("test_window", 128, 128, 128)
+ print("Border color test: RGB(128, 128, 128)")
+
+ -- Test border width
+ srd.window.set_border_width("test_window", 5)
+ print("Border width test: 5px")
+end
+
+-- Test function for window state system
+function test_window_state_system()
+ print("Testing window state system...")
+
+ -- Test floating state
+ srd.window.set_floating("test_window", true)
+ local is_floating = srd.window.is_floating("test_window")
+ print("Floating state test: " .. tostring(is_floating))
+
+ -- Test toggle
+ srd.window.toggle_floating("test_window")
+ is_floating = srd.window.is_floating("test_window")
+ print("Toggle test: " .. tostring(is_floating))
+end
+
+-- Run tests
+test_platform_features()
+test_decoration_system()
+test_window_state_system()
+
+print("Cross-platform test configuration loaded successfully!")
+print("Use Mod4+1/2/3 to switch layouts")
+print("Use Mod4+f to toggle floating")
+print("Use Mod4+b/n/r to change border colors")
+print("Use Mod4+0 to reset decorations")
+print("Use Mod4+s for smart placement info")
diff --git a/config/srd/init.lua b/config/srd/init.lua
new file mode 100644
index 0000000..5458be4
--- /dev/null
+++ b/config/srd/init.lua
@@ -0,0 +1,51 @@
+-- SRDWM Main Configuration Entry Point
+-- This file is loaded first and sets up the basic configuration
+
+local srd = require("srd")
+
+-- Load all configuration modules
+srd.load("keybindings")
+srd.load("layouts")
+srd.load("themes")
+srd.load("rules")
+srd.load("monitors")
+srd.load("startup")
+
+-- Global settings
+srd.set("general.default_layout", "dynamic")
+srd.set("general.smart_placement", true)
+srd.set("general.window_gap", 8)
+srd.set("general.border_width", 2)
+srd.set("general.animations", true)
+srd.set("general.animation_duration", 200)
+
+-- Monitor settings
+srd.set("monitor.primary_layout", "dynamic")
+srd.set("monitor.secondary_layout", "tiling")
+
+-- Window behavior
+srd.set("window.focus_follows_mouse", false)
+srd.set("window.mouse_follows_focus", true)
+srd.set("window.auto_raise", false)
+srd.set("window.auto_focus", true)
+
+-- Workspace settings
+srd.set("workspace.count", 10)
+srd.set("workspace.names", {
+ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"
+})
+
+-- Performance settings
+srd.set("performance.vsync", true)
+srd.set("performance.max_fps", 60)
+srd.set("performance.window_cache_size", 100)
+
+-- Debug settings
+srd.set("debug.logging", true)
+srd.set("debug.log_level", "info")
+srd.set("debug.profile", false)
+
+-- Print startup message
+srd.notify("SRDWM Configuration Loaded", "info")
+print("SRDWM configuration loaded successfully")
+
diff --git a/config/srd/keybindings.lua b/config/srd/keybindings.lua
new file mode 100644
index 0000000..253fd5a
--- /dev/null
+++ b/config/srd/keybindings.lua
@@ -0,0 +1,217 @@
+-- SRDWM Key Bindings Configuration
+-- Define all keyboard shortcuts and their actions
+
+local srd = require("srd")
+
+-- Layout switching
+srd.bind("Mod4+1", function()
+ srd.layout.set("tiling")
+ srd.notify("Layout: Tiling", "info")
+end)
+
+srd.bind("Mod4+2", function()
+ srd.layout.set("dynamic")
+ srd.notify("Layout: Dynamic", "info")
+end)
+
+srd.bind("Mod4+3", function()
+ srd.layout.set("floating")
+ srd.notify("Layout: Floating", "info")
+end)
+
+-- Window management
+srd.bind("Mod4+q", function()
+ local window = srd.window.focused()
+ if window then
+ window:close()
+ end
+end)
+
+srd.bind("Mod4+m", function()
+ local window = srd.window.focused()
+ if window then
+ window:minimize()
+ end
+end)
+
+srd.bind("Mod4+f", function()
+ local window = srd.window.focused()
+ if window then
+ window:maximize()
+ end
+end)
+
+-- Window movement (vim-style)
+srd.bind("Mod4+h", function()
+ srd.window.focus("left")
+end)
+
+srd.bind("Mod4+j", function()
+ srd.window.focus("down")
+end)
+
+srd.bind("Mod4+k", function()
+ srd.window.focus("up")
+end)
+
+srd.bind("Mod4+l", function()
+ srd.window.focus("right")
+end)
+
+-- Window resizing
+srd.bind("Mod4+Shift+h", function()
+ local window = srd.window.focused()
+ if window then
+ local x, y, w, h = window:get_geometry()
+ window:set_geometry(x - 10, y, w + 10, h)
+ end
+end)
+
+srd.bind("Mod4+Shift+j", function()
+ local window = srd.window.focused()
+ if window then
+ local x, y, w, h = window:get_geometry()
+ window:set_geometry(x, y, w, h + 10)
+ end
+end)
+
+srd.bind("Mod4+Shift+k", function()
+ local window = srd.window.focused()
+ if window then
+ local x, y, w, h = window:get_geometry()
+ window:set_geometry(x, y - 10, w, h + 10)
+ end
+end)
+
+srd.bind("Mod4+Shift+l", function()
+ local window = srd.window.focused()
+ if window then
+ local x, y, w, h = window:get_geometry()
+ window:set_geometry(x, y, w + 10, h)
+ end
+end)
+
+-- Workspace management
+srd.bind("Mod4+Tab", function()
+ srd.workspace.next()
+end)
+
+srd.bind("Mod4+Shift+Tab", function()
+ srd.workspace.prev()
+end)
+
+-- Workspace switching with number keys
+for i = 1, 10 do
+ srd.bind("Mod4+" .. i, function()
+ srd.workspace.switch(i)
+ end)
+
+ srd.bind("Mod4+Shift+" .. i, function()
+ local window = srd.window.focused()
+ if window then
+ srd.workspace.move_window(window, i)
+ end
+ end)
+end
+
+-- Monitor switching
+srd.bind("Mod4+Left", function()
+ srd.monitor.focus("left")
+end)
+
+srd.bind("Mod4+Right", function()
+ srd.monitor.focus("right")
+end)
+
+-- Window state toggles
+srd.bind("Mod4+Shift+space", function()
+ local window = srd.window.focused()
+ if window then
+ if window:is_floating() then
+ window:set_tiling()
+ else
+ window:set_floating()
+ end
+ end
+end)
+
+srd.bind("Mod4+Shift+f", function()
+ local window = srd.window.focused()
+ if window then
+ if window:is_fullscreen() then
+ window:unset_fullscreen()
+ else
+ window:set_fullscreen()
+ end
+ end
+end)
+
+-- Quick actions
+srd.bind("Mod4+d", function()
+ srd.spawn("rofi -show drun")
+end)
+
+srd.bind("Mod4+Return", function()
+ srd.spawn("alacritty")
+end)
+
+srd.bind("Mod4+r", function()
+ srd.spawn("rofi -show run")
+end)
+
+srd.bind("Mod4+w", function()
+ srd.spawn("firefox")
+end)
+
+-- System actions
+srd.bind("Mod4+Shift+q", function()
+ srd.quit()
+end)
+
+srd.bind("Mod4+Shift+r", function()
+ srd.reload_config()
+end)
+
+srd.bind("Mod4+Shift+l", function()
+ srd.spawn("i3lock")
+end)
+
+-- Custom functions
+function toggle_gaps()
+ local current_gap = srd.get("general.window_gap")
+ if current_gap > 0 then
+ srd.set("general.window_gap", 0)
+ srd.notify("Gaps: Off", "info")
+ else
+ srd.set("general.window_gap", 8)
+ srd.notify("Gaps: On", "info")
+ end
+end
+
+srd.bind("Mod4+g", toggle_gaps)
+
+-- Volume control
+srd.bind("XF86AudioRaiseVolume", function()
+ srd.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%")
+end)
+
+srd.bind("XF86AudioLowerVolume", function()
+ srd.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%")
+end)
+
+srd.bind("XF86AudioMute", function()
+ srd.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")
+end)
+
+-- Brightness control
+srd.bind("XF86MonBrightnessUp", function()
+ srd.spawn("brightnessctl set +5%")
+end)
+
+srd.bind("XF86MonBrightnessDown", function()
+ srd.spawn("brightnessctl set 5%-")
+end)
+
+-- Print key bindings loaded
+print("Key bindings configuration loaded")
+
diff --git a/config/srd/test_decorations.lua b/config/srd/test_decorations.lua
new file mode 100644
index 0000000..162517f
--- /dev/null
+++ b/config/srd/test_decorations.lua
@@ -0,0 +1,127 @@
+-- Test configuration for decoration and window state controls
+-- This file demonstrates the cross-platform decoration and tiling/floating functionality
+
+print("Loading decoration and window state test configuration...")
+
+-- Global decoration settings
+srd.set("general.decorations_enabled", true)
+srd.set("general.border_width", 3)
+srd.set("general.border_color", "#2e3440")
+
+-- Keybindings for decoration and window state controls
+srd.bind("Mod4+d", function()
+ -- Toggle decorations for focused window
+ local window = srd.window.focused()
+ if window then
+ local current = srd.window.get_decorations(window.id)
+ srd.window.set_decorations(window.id, not current)
+ print("Toggled decorations for window " .. window.id)
+ end
+end)
+
+srd.bind("Mod4+b", function()
+ -- Toggle border color for focused window
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_border_color(window.id, 255, 0, 0) -- Red border
+ print("Set red border for window " .. window.id)
+ end
+end)
+
+srd.bind("Mod4+n", function()
+ -- Toggle border color back to normal
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_border_color(window.id, 46, 52, 64) -- Default color
+ print("Reset border color for window " .. window.id)
+ end
+end)
+
+srd.bind("Mod4+w", function()
+ -- Toggle border width
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_border_width(window.id, 8) -- Thick border
+ print("Set thick border for window " .. window.id)
+ end
+end)
+
+srd.bind("Mod4+s", function()
+ -- Reset border width
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_border_width(window.id, 3) -- Normal border
+ print("Reset border width for window " .. window.id)
+ end
+end)
+
+-- Window state controls
+srd.bind("Mod4+f", function()
+ -- Toggle floating state for focused window
+ local window = srd.window.focused()
+ if window then
+ srd.window.toggle_floating(window.id)
+ local floating = srd.window.is_floating(window.id)
+ print("Window " .. window.id .. " floating: " .. tostring(floating))
+ end
+end)
+
+srd.bind("Mod4+t", function()
+ -- Set window to tiling mode
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_floating(window.id, false)
+ print("Set window " .. window.id .. " to tiling mode")
+ end
+end)
+
+srd.bind("Mod4+l", function()
+ -- Set window to floating mode
+ local window = srd.window.focused()
+ if window then
+ srd.window.set_floating(window.id, true)
+ print("Set window " .. window.id .. " to floating mode")
+ end
+end)
+
+-- Layout switching with decoration awareness
+srd.bind("Mod4+1", function()
+ srd.layout.set("tiling")
+ print("Switched to tiling layout")
+end)
+
+srd.bind("Mod4+2", function()
+ srd.layout.set("dynamic")
+ print("Switched to dynamic layout")
+end)
+
+srd.bind("Mod4+3", function()
+ srd.layout.set("floating")
+ print("Switched to floating layout")
+end)
+
+-- Test function to apply decorations to all windows
+function apply_test_decorations()
+ print("Applying test decorations to all windows...")
+
+ -- This would iterate through all windows in a real implementation
+ -- For now, we'll just demonstrate the API
+
+ -- Example: Apply red border to window with ID "1"
+ srd.window.set_border_color("1", 255, 0, 0)
+ srd.window.set_border_width("1", 5)
+
+ -- Example: Apply blue border to window with ID "2"
+ srd.window.set_border_color("2", 0, 0, 255)
+ srd.window.set_border_width("2", 3)
+
+ -- Example: Disable decorations for window with ID "3"
+ srd.window.set_decorations("3", false)
+
+ print("Test decorations applied")
+end
+
+-- Call the test function
+apply_test_decorations()
+
+print("Decoration and window state test configuration loaded successfully!")
diff --git a/config/srdwm.conf b/config/srdwm.conf
new file mode 100644
index 0000000..4632a6f
--- /dev/null
+++ b/config/srdwm.conf
@@ -0,0 +1,182 @@
+# SRDWM Configuration File
+# This file demonstrates the configuration options for the cross-platform window manager
+
+# General Settings
+general {
+ # Default layout type: "tiling", "dynamic", or "floating"
+ default_layout = "dynamic"
+
+ # Enable smart window placement (Windows 11 style)
+ smart_placement = true
+
+ # Window border settings
+ border_width = 2
+ border_color = "#2e3440"
+ focused_border_color = "#88c0d0"
+
+ # Gap between windows
+ window_gap = 8
+
+ # Enable window animations
+ animations = true
+ animation_duration = 200
+}
+
+# Key Bindings
+keybindings {
+ # Layout switching
+ "Mod4+1" = "layout tiling"
+ "Mod4+2" = "layout dynamic"
+ "Mod4+3" = "layout floating"
+
+ # Window management
+ "Mod4+q" = "close_window"
+ "Mod4+m" = "minimize_window"
+ "Mod4+f" = "maximize_window"
+
+ # Window movement
+ "Mod4+h" = "move_left"
+ "Mod4+j" = "move_down"
+ "Mod4+k" = "move_up"
+ "Mod4+l" = "move_right"
+
+ "Mod4+Shift+h" = "resize_left"
+ "Mod4+Shift+j" = "resize_down"
+ "Mod4+Shift+k" = "resize_up"
+ "Mod4+Shift+l" = "resize_right"
+
+ # Workspace management
+ "Mod4+Tab" = "next_workspace"
+ "Mod4+Shift+Tab" = "prev_workspace"
+
+ # Quick actions
+ "Mod4+d" = "show_launcher"
+ "Mod4+Return" = "spawn_terminal"
+ "Mod4+r" = "spawn_runner"
+}
+
+# Layout Settings
+layouts {
+ tiling {
+ # Tiling layout specific settings
+ split_ratio = 0.5
+ master_ratio = 0.6
+ auto_swap = true
+ }
+
+ dynamic {
+ # Dynamic layout settings
+ snap_threshold = 50
+ grid_size = 6
+ cascade_offset = 30
+ }
+
+ floating {
+ # Floating layout settings
+ default_position = "center"
+ remember_position = true
+ }
+}
+
+# Window Rules
+window_rules {
+ # Terminal windows
+ rule {
+ match_type = "class"
+ match_value = "terminal"
+ properties {
+ layout = "tiling"
+ workspace = "1"
+ }
+ }
+
+ # Browser windows
+ rule {
+ match_type = "class"
+ match_value = "browser"
+ properties {
+ layout = "dynamic"
+ workspace = "2"
+ }
+ }
+
+ # Floating windows
+ rule {
+ match_type = "class"
+ match_value = "dialog"
+ properties {
+ layout = "floating"
+ always_on_top = true
+ }
+ }
+}
+
+# Theme Settings
+theme {
+ name = "nord"
+
+ colors {
+ background = "#2e3440"
+ foreground = "#eceff4"
+ primary = "#88c0d0"
+ secondary = "#81a1c1"
+ accent = "#5e81ac"
+ error = "#bf616a"
+ warning = "#ebcb8b"
+ success = "#a3be8c"
+ }
+
+ fonts {
+ main = "JetBrains Mono:size=10"
+ title = "JetBrains Mono:size=12:weight=bold"
+ ui = "JetBrains Mono:size=9"
+ }
+
+ dimensions {
+ title_bar_height = 24
+ status_bar_height = 20
+ menu_padding = 8
+ }
+}
+
+# Monitor Settings
+monitors {
+ # Primary monitor
+ primary {
+ layout = "dynamic"
+ workspace_count = 10
+ }
+
+ # Secondary monitors
+ secondary {
+ layout = "tiling"
+ workspace_count = 5
+ }
+}
+
+# Performance Settings
+performance {
+ # Enable vsync
+ vsync = true
+
+ # Frame rate limit
+ max_fps = 60
+
+ # Memory management
+ window_cache_size = 100
+ event_queue_size = 1000
+}
+
+# Debug Settings
+debug {
+ # Enable debug logging
+ logging = true
+ log_level = "info"
+
+ # Performance profiling
+ profile = false
+
+ # Event tracing
+ trace_events = false
+}
+