feat: introduce v2.0 abstraction layer with core types, backend interface, and plugin system
feat: add fade effects with API control and real-time event subscription test: add API integration tests with isolated test environment and coverage reporting build: update Makefile for recursive source finding, dynamic linking, and test targets docs: document abstraction layer, fade effects, and API enhancements in README
This commit is contained in:
+64
-27
@@ -13,7 +13,7 @@
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<h1>DWN</h1>
|
||||
<span class="version">v1.0.0</span>
|
||||
<span class="version">v2.0.0</span>
|
||||
</div>
|
||||
|
||||
<div class="search-box">
|
||||
@@ -47,6 +47,8 @@
|
||||
<div class="nav-section">
|
||||
<div class="nav-section-title">Advanced</div>
|
||||
<a href="architecture.html" class="nav-link">Architecture</a>
|
||||
<a href="abstraction-layer.html" class="nav-link">Abstraction Layer</a>
|
||||
<a href="plugin-development.html" class="nav-link">Plugin Development</a>
|
||||
<a href="building.html" class="nav-link">Building from Source</a>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -98,7 +100,7 @@ port = 8777</code></pre>
|
||||
</div>
|
||||
|
||||
<h2 id="connecting">Connecting</h2>
|
||||
<p>Connect via WebSocket to <code>ws://localhost:8777</code> (or your configured port).</p>
|
||||
<p>Connect via WebSocket to <code>ws://localhost:8777/ws</code> (or your configured port). The <code>/ws</code> path is required.</p>
|
||||
|
||||
<h3>Testing with wscat</h3>
|
||||
<div class="code-block">
|
||||
@@ -106,11 +108,11 @@ port = 8777</code></pre>
|
||||
npm install -g wscat
|
||||
|
||||
# Connect to DWN
|
||||
wscat -c ws://localhost:8777
|
||||
wscat -c ws://localhost:8777/ws
|
||||
|
||||
# Send a command
|
||||
> {"command": "list_windows"}
|
||||
< {"status": "ok", "windows": [...]}</code></pre>
|
||||
> {"command": "get_clients"}
|
||||
< {"status": "ok", "clients": [...]}</code></pre>
|
||||
</div>
|
||||
|
||||
<h3>Testing with websocat</h3>
|
||||
@@ -119,7 +121,7 @@ wscat -c ws://localhost:8777
|
||||
cargo install websocat
|
||||
|
||||
# Connect and send command
|
||||
echo '{"command": "list_windows"}' | websocat ws://localhost:8777</code></pre>
|
||||
echo '{"command": "get_clients"}' | websocat ws://localhost:8777/ws</code></pre>
|
||||
</div>
|
||||
|
||||
<h2 id="protocol">Protocol</h2>
|
||||
@@ -161,24 +163,24 @@ echo '{"command": "list_windows"}' | websocat ws://localhost:8777</code></pre>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Windows</td>
|
||||
<td>list_windows, focus_window, close_window, move_window, resize_window</td>
|
||||
<td>Clients</td>
|
||||
<td>get_clients, find_clients, get_focused_client, focus_client, focus_next, focus_prev, focus_master, close_client, kill_client, move_client, resize_client, minimize_client, restore_client, maximize_client, fullscreen_client, float_client, raise_client, lower_client, snap_client</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Workspaces</td>
|
||||
<td>list_workspaces, switch_workspace, move_to_workspace</td>
|
||||
<td>get_workspaces, switch_workspace, switch_workspace_next, switch_workspace_prev, move_client_to_workspace</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Layout</td>
|
||||
<td>get_layout, set_layout, set_master_ratio</td>
|
||||
<td>set_layout, cycle_layout, set_master_ratio, adjust_master_ratio, set_master_count, adjust_master_count</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Keyboard</td>
|
||||
<td>key_press, key_release, type_text</td>
|
||||
<td>key_press, key_release, key_tap, key_type, get_keybindings</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mouse</td>
|
||||
<td>mouse_move, mouse_click, mouse_drag</td>
|
||||
<td>mouse_move, mouse_move_relative, mouse_click, mouse_press, mouse_release, mouse_scroll, get_mouse_position</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Screenshot</td>
|
||||
@@ -190,7 +192,39 @@ echo '{"command": "list_windows"}' | websocat ws://localhost:8777</code></pre>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>System</td>
|
||||
<td>get_monitors, spawn, notify</td>
|
||||
<td>get_status, get_screen_info, run_command, show_desktop, get_config, reload_config</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Notifications</td>
|
||||
<td>notify, close_notification, get_notifications</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>System Tray</td>
|
||||
<td>get_battery_state, get_audio_state, set_audio_volume, toggle_audio_mute, get_wifi_state</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Panels</td>
|
||||
<td>get_panel_state, show_panel, hide_panel, toggle_panel</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>AI</td>
|
||||
<td>ai_is_available, ai_command, exa_is_available, exa_search</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>News</td>
|
||||
<td>get_news, news_next, news_prev, news_open</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Demo/Tutorial</td>
|
||||
<td>start_demo, stop_demo, get_demo_state, start_tutorial, stop_tutorial, get_tutorial_state</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Events</td>
|
||||
<td>subscribe, unsubscribe, list_events</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fade Effects</td>
|
||||
<td>get_fade_settings, set_fade_speed, set_fade_intensity</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -198,32 +232,35 @@ echo '{"command": "list_windows"}' | websocat ws://localhost:8777</code></pre>
|
||||
|
||||
<h2 id="quick-start">Quick Start</h2>
|
||||
|
||||
<h3>List Windows</h3>
|
||||
<h3>List Clients</h3>
|
||||
<div class="code-block">
|
||||
<pre><code>// Request
|
||||
{"command": "list_windows"}
|
||||
{"command": "get_clients"}
|
||||
|
||||
// Response
|
||||
{
|
||||
"status": "ok",
|
||||
"windows": [
|
||||
"clients": [
|
||||
{
|
||||
"id": 12345678,
|
||||
"window": 12345678,
|
||||
"title": "Firefox",
|
||||
"class": "firefox",
|
||||
"workspace": 0,
|
||||
"x": 0, "y": 32,
|
||||
"width": 960, "height": 540,
|
||||
"focused": true,
|
||||
"floating": false
|
||||
"floating": false,
|
||||
"fullscreen": false,
|
||||
"maximized": false,
|
||||
"minimized": false
|
||||
}
|
||||
]
|
||||
}</code></pre>
|
||||
</div>
|
||||
|
||||
<h3>Focus a Window</h3>
|
||||
<h3>Focus a Client</h3>
|
||||
<div class="code-block">
|
||||
<pre><code>{"command": "focus_window", "window": 12345678}</code></pre>
|
||||
<pre><code>{"command": "focus_client", "window": 12345678}</code></pre>
|
||||
</div>
|
||||
|
||||
<h3>Switch Workspace</h3>
|
||||
@@ -233,7 +270,7 @@ echo '{"command": "list_windows"}' | websocat ws://localhost:8777</code></pre>
|
||||
|
||||
<h3>Type Text</h3>
|
||||
<div class="code-block">
|
||||
<pre><code>{"command": "type_text", "text": "Hello, World!"}</code></pre>
|
||||
<pre><code>{"command": "key_type", "text": "Hello, World!"}</code></pre>
|
||||
</div>
|
||||
|
||||
<h3>Take Screenshot</h3>
|
||||
@@ -263,11 +300,11 @@ echo '{"command": "list_windows"}' | websocat ws://localhost:8777</code></pre>
|
||||
client = DWNClient()
|
||||
client.connect()
|
||||
|
||||
# List windows
|
||||
windows = client.list_windows()
|
||||
# List clients
|
||||
clients = client.get_clients()
|
||||
|
||||
# Focus a window
|
||||
client.focus_window(windows[0]['id'])
|
||||
# Focus a client
|
||||
client.focus_client(clients[0]['window'])
|
||||
|
||||
# Take screenshot
|
||||
result = client.screenshot('fullscreen')
|
||||
@@ -280,10 +317,10 @@ client.disconnect()</code></pre>
|
||||
|
||||
<h3>JavaScript (Browser)</h3>
|
||||
<div class="code-block">
|
||||
<pre><code>const ws = new WebSocket('ws://localhost:8777');
|
||||
<pre><code>const ws = new WebSocket('ws://localhost:8777/ws');
|
||||
|
||||
ws.onopen = () => {
|
||||
ws.send(JSON.stringify({command: 'list_windows'}));
|
||||
ws.send(JSON.stringify({command: 'get_clients'}));
|
||||
};
|
||||
|
||||
ws.onmessage = (event) => {
|
||||
|
||||
Reference in New Issue
Block a user