# Configuration

Customize DWN to your preferences

## Configuration File

DWN uses an INI-style configuration file located at:

    ~/.config/dwn/config

Create it from the example:

    mkdir -p ~/.config/dwn
    cp /etc/dwn/config.example ~/.config/dwn/config

## Configuration Sections

### [general] - Core Settings

    [general]
    terminal = xfce4-terminal
    launcher = dmenu_run
    file_manager = thunar
    focus_mode = click
    focus_follow_delay = 100
    decorations = true

Option | Default | Description
--- | --- | ---
`terminal` | xfce4-terminal | Terminal emulator command
`launcher` | dmenu_run | Application launcher command
`file_manager` | thunar | File manager command
`focus_mode` | click | `click` or `follow` (sloppy focus)
`focus_follow_delay` | 100 | Delay in ms for focus-follow mode (0-1000)
`decorations` | true | Show window decorations (title bar)

### [appearance] - Visual Settings

    [appearance]
    border_width = 0
    title_height = 28
    panel_height = 32
    gap = 0
    font = fixed

Option | Range | Description
--- | --- | ---
`border_width` | 0-50 | Window border width in pixels
`title_height` | 0-100 | Title bar height in pixels
`panel_height` | 0-100 | Panel height in pixels
`gap` | 0-100 | Gap between windows in pixels
`font` | - | X11 font name

### [layout] - Layout Behavior

    [layout]
    default = tiling
    master_ratio = 0.55
    master_count = 1

Option | Values | Description
--- | --- | ---
`default` | tiling, floating, monocle | Default layout for new workspaces
`master_ratio` | 0.1-0.9 | Master area ratio in tiling layout
`master_count` | 1-10 | Number of windows in master area

### [panels] - Panel Visibility

    [panels]
    top = true
    bottom = true

### [colors] - Color Scheme

Colors are specified in hex format `#RRGGBB`.

    [colors]
    panel_bg = #1a1a2e
    panel_fg = #e0e0e0
    workspace_active = #4a90d9
    workspace_inactive = #3a3a4e
    workspace_urgent = #d94a4a
    title_focused_bg = #2d3a4a
    title_focused_fg = #ffffff
    title_unfocused_bg = #1a1a1a
    title_unfocused_fg = #808080
    border_focused = #4a90d9
    border_unfocused = #333333
    notification_bg = #2a2a3e
    notification_fg = #ffffff

### [api] - WebSocket API

    [api]
    enabled = true
    port = 8777

Option | Default | Description
--- | --- | ---
`enabled` | false | Enable WebSocket API server
`port` | 8777 | API server port number

### [ai] - AI Integration

    [ai]
    model = google/gemini-2.0-flash-exp:free
    openrouter_api_key = sk-or-v1-your-key
    exa_api_key = your-exa-key

API keys can also be set via environment variables:

- `OPENROUTER_API_KEY`
- `EXA_API_KEY`

### [autostart] - XDG Autostart

    [autostart]
    enabled = true
    xdg_autostart = true
    path = ~/.config/dwn/autostart.d

Directories scanned when `xdg_autostart = true`:

- `/etc/xdg/autostart/*.desktop` - System defaults
- `~/.config/autostart/*.desktop` - User autostart
- `~/.config/dwn/autostart.d/*` - DWN-specific scripts

### [demo] - Demo Mode Timing

    [demo]
    step_delay = 4000
    ai_timeout = 15000
    window_timeout = 5000

### [rules] - Window Rules

Automatically apply settings to windows based on their class or title. Rules use glob patterns for matching.

    [rules]
    Firefox = workspace:2, floating:false
    class:*terminal* = workspace:1
    title:*Calculator* = floating:true, width:400, height:300
    class:Telegram = workspace:9, sticky:true
    Gimp = floating:true
    class:mpv = fullscreen:true

#### Rule Syntax

Each rule has the format: `pattern = property:value, property:value, ...`

Pattern Prefix | Description
--- | ---
`class:` | Match by WM_CLASS (default if no prefix)
`title:` | Match by window title
(no prefix) | Treated as class pattern

#### Available Properties

Property | Values | Description
--- | --- | ---
`workspace` | 1-9 | Move to specific workspace
`floating` | true/false | Set floating mode
`sticky` | true/false | Visible on all workspaces
`fullscreen` | true/false | Start in fullscreen mode
`width` | pixels | Set initial width
`height` | pixels | Set initial height
`x` | pixels | Set initial X position
`y` | pixels | Set initial Y position

#### Pattern Matching

- `*` - Matches any sequence of characters
- `?` - Matches any single character
- `[abc]` - Matches any character in brackets
- Matching is case-insensitive

#### Examples

    [rules]
    # Open Firefox on workspace 2
    Firefox = workspace:2

    # All terminals on workspace 1
    class:*terminal* = workspace:1

    # Calculator always floating with specific size
    title:*Calculator* = floating:true, width:400, height:300

    # Picture-in-picture windows
    title:Picture-in-Picture = floating:true, sticky:true

    # Gimp dialogs floating
    class:Gimp = floating:true

    # Video players fullscreen
    class:mpv = fullscreen:true
    class:vlc = fullscreen:true

## Environment Variables

Variable | Description
--- | ---
`OPENROUTER_API_KEY` | API key for AI command palette
`EXA_API_KEY` | API key for Exa semantic search
`DISPLAY` | X server to connect to

## Example Configuration

    [general]
    terminal = alacritty
    launcher = rofi -show drun
    file_manager = nautilus
    focus_mode = click
    decorations = true

    [appearance]
    border_width = 2
    title_height = 24
    panel_height = 28
    gap = 5
    font = monospace

    [layout]
    default = tiling
    master_ratio = 0.55
    master_count = 1

    [panels]
    top = true
    bottom = false

    [colors]
    panel_bg = #282c34
    panel_fg = #abb2bf
    workspace_active = #61afef
    workspace_inactive = #3e4451
    border_focused = #61afef
    border_unfocused = #3e4451

    [api]
    enabled = true
    port = 8777

    [autostart]
    enabled = true
    xdg_autostart = true