chore: add WebSocket API documentation and auto-organization feature cards to site pages

This commit is contained in:
2026-01-08 23:18:43 +00:00
parent 4793d372ac
commit eb492cd5ff
5 changed files with 247 additions and 366 deletions
+64
View File
@@ -62,6 +62,7 @@
<li>
<span class="section-title">Reference</span>
<ul>
<li><a href="#api">WebSocket API</a></li>
<li><a href="shortcuts.html">Keyboard Shortcuts</a></li>
<li><a href="configuration.html">Configuration</a></li>
<li><a href="ai-features.html">AI Features</a></li>
@@ -340,6 +341,69 @@
the current article with <kbd>Super</kbd> + <kbd>Return</kbd>. Both panels can
be hidden in the configuration if you prefer a minimal setup.
</p>
<h2 id="api">WebSocket API</h2>
<p>
DWN exposes a real-time WebSocket API (default port <code>8777</code>) that allows for
complete programmatic control of the window manager.
</p>
<div class="card">
<h3>Connecting</h3>
<p>Endpoint: <code>ws://localhost:8777/ws</code></p>
<p>The API must be enabled in your configuration:</p>
<pre><code>[api]
enabled = true
port = 8777</code></pre>
</div>
<h3>Supported Commands</h3>
<div class="table-wrapper">
<table>
<thead>
<tr>
<th>Command</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>get_status</code></td>
<td>Get WM version and current workspace ID</td>
</tr>
<tr>
<td><code>get_workspaces</code></td>
<td>List all workspaces and their client counts</td>
</tr>
<tr>
<td><code>get_clients</code></td>
<td>Get details of all managed windows</td>
</tr>
<tr>
<td><code>switch_workspace</code></td>
<td>Change to a specific workspace ID</td>
</tr>
<tr>
<td><code>run_command</code></td>
<td>Execute a shell command</td>
</tr>
<tr>
<td><code>focus_client</code></td>
<td>Focus a specific window by ID</td>
</tr>
</tbody>
</table>
</div>
<h3>Advanced Examples</h3>
<p>
Check the <code>scripts/api_examples/</code> directory in the source tree for
sophisticated implementations:
</p>
<ul>
<li><strong>Window Picker</strong> (<code>window_picker_fzf.py</code>) - Fuzzy finder for windows.</li>
<li><strong>Session Manager</strong> (<code>session_manager.py</code>) - Save/restore window layouts.</li>
<li><strong>Web Remote</strong> (<code>web_remote.html</code>) - Browser-based dashboard.</li>
<li><strong>Auto-Manager</strong> (<code>listen.py</code>) - Proactive workspace optimization.</li>
</ul>
<h2>Next Steps</h2>
<p>Now that you know the basics, explore these topics:</p>
<ul>